home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-cat-kerberos-02.txt < prev    next >
Text File  |  1993-04-21  |  243KB  |  7,591 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. INTERNET-DRAFT                       John    Kohl
  8.                       B. Clifford Neuman
  9.                            21 April    1993
  10.  
  11.  
  12.  
  13.      The Kerberos Network Authentication Service (V5)
  14.  
  15.  
  16. STATUS OF THIS MEMO
  17.  
  18.      This document is an Internet  Draft.   Internet  Drafts
  19. are working documents of the Internet Engineering Task Force
  20. (IETF),    its Areas, and its Working Groups. Note     that  other
  21. groups    may  also  distribute  working documents as Internet
  22. Drafts.
  23.  
  24.      Internet Drafts are draft documents valid for a maximum
  25. of  six     months.   Internet Drafts may be updated, replaced,
  26. or obsoleted by    other documents    at  any     time.     It  is     not
  27. appropriate  to    use Internet Drafts as reference material or
  28. to cite    them other than    as a "working  draft"  or  "work  in
  29. progress."
  30.  
  31.      Please check the I-D abstract listing contained in    each
  32. Internet Draft directory to learn the current status of    this
  33. or any other Internet Draft.  Distribution of this  memo  is
  34. unlimited. Please send comments    to "krb-protocol@MIT.EDU."
  35.  
  36. ABSTRACT
  37.  
  38.      This document gives an overview  and  specification  of
  39. Version    5 of the protocol for the Kerberos network authenti-
  40. cation system.    Version    4,  described  elsewhere  [1,2],  is
  41. presently  in production use at    MIT's Project Athena, and at
  42. other Internet sites.
  43.  
  44. OVERVIEW
  45.  
  46.      This INTERNET-DRAFT describes the    concepts  and  model
  47. upon  which  the  Kerberos  network authentication system is
  48. based.    It also    specifies Version 5 of the  Kerberos  proto-
  49. col.
  50.  
  51.      The  motivations,    goals,    assumptions,  and  rationale
  52. behind most design decisions are treated cursorily; for    Ver-
  53. sion 4 they are    fully described    in the Kerberos     portion  of
  54. __________________________
  55. Project    Athena,    Athena,    Athena MUSE,  Discuss,    Hesiod,
  56. Kerberos,  Moira, and Zephyr are trademarks of the Mas-
  57. sachusetts Institute of    Technology (MIT).   No    commer-
  58. cial  use of these trademarks may be made without prior
  59. written    permission of MIT.
  60.  
  61.  
  62.  
  63. Overview           - 1 -     Expires 15    October    1993
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.           Version 5 - Revision 5.2
  71.  
  72.  
  73. the Athena Technical Plan  [1].      The  protocols  are  under
  74. review,     and are not being submitted for consideration as an
  75. Internet standard at this time.      Comments  are     encouraged.
  76. Requests for addition to an electronic mailing list for    dis-
  77. cussion    of Kerberos, kerberos@MIT.EDU, may be  addressed  to
  78. kerberos-request@MIT.EDU.   This  mailing  list    is gatewayed
  79. onto  the  Usenet  as  the  group   comp.protocols.kerberos.
  80. Requests  for  further    information, including documents and
  81. code availability, may be sent to info-kerberos@MIT.EDU.
  82.  
  83. BACKGROUND
  84.  
  85.      The Kerberos model    is based  in  part  on    Needham     and
  86. Schroeder's  trusted third-party authentication    protocol [3]
  87. and on modifications suggested by  Denning  and     Sacco    [4].
  88. The  original design and implementation    of Kerberos Versions
  89. 1 through 4 was    the work of two    former Project Athena  staff
  90. members,  Steve     Miller    of Digital Equipment Corporation and
  91. Clifford Neuman    (now at    the Information     Sciences  Institute
  92. of the University of Southern California), along with Jerome
  93. Saltzer, Technical Director of Project Athena,    and  Jeffrey
  94. Schiller, MIT Campus Network Manager.  Many other members of
  95. Project    Athena have also contributed to     the  work  on    Ker-
  96. beros.     Version  4 is publicly    available, and has seen    wide
  97. use across the Internet.
  98.  
  99.      Version 5 (described in this document) has    evolved    from
  100. Version    4 based    on new requirements and    desires    for features
  101. not available in Version  4.   Details    on  the     differences
  102. between    Kerberos Versions 4 and    5 can be found in [5].
  103.  
  104. 1.  Introduction
  105.  
  106.      Kerberos provides a means of verifying  the  identities
  107. of principals, (e.g. a workstation user    or a network server)
  108. on an open  (unprotected)  network.   This  is    accomplished
  109. without    relying    on authentication by the host operating    sys-
  110. tem, without basing trust on host addresses, without requir-
  111. ing  physical  security    of all the hosts on the    network, and
  112. under the assumption that packets traveling along  the    net-
  113. work can be read, modified, and    inserted at  will[1].    Ker-
  114. beros  performs     authentication     under these conditions    as a
  115. trusted    third-party authentication service by using  conven-
  116. tional (shared secret key[2]) cryptography.
  117. __________________________
  118. [1] Note, however, that    many applications use Kerberos'
  119. functions  only     upon  the initiation of a stream-based
  120. network    connection, and    assume the absence of any ``hi-
  121. jackers''  who    might  subvert such a connection.  Such
  122. use implicitly trusts the host addresses involved.
  123.  
  124. [2] Secret  and     private are often used    interchangeably
  125. in the literature.  In our  usage,  it    takes  two  (or
  126. more)  to  share  a  secret, thus a shared DES key is a
  127. secret key.  Something is only private when no one  but
  128.  
  129. Section    1.           - 2 -     Expires 15    October    1993
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.           Version 5 - Revision 5.2
  137.  
  138.  
  139.      The  authentication  process  proceeds  as     follows:  A
  140. client    sends  a  request  to the authentication server    (AS)
  141. requesting  "credentials"  for    a  given  server.   The      AS
  142. responds  with    these credentials, encrypted in    the client's
  143. key.  The credentials consist  of  1)  a  "ticket"  for     the
  144. server    and  2)     a  temporary encryption key (often called a
  145. "session key").     The client transmits the ticket (which    con-
  146. tains  the  client's identity and a copy of the    session    key,
  147. all encrypted in the server's key) to the server.  The    ses-
  148. sion  key  (now     shared    by the client and server) is used to
  149. authenticate the client,  and  may  optionally    be  used  to
  150. authenticate  the  server.   It     may also be used to encrypt
  151. further    communication between the two parties or to exchange
  152. a  separate  sub-session  key  to be used to encrypt further
  153. communication.
  154.  
  155.      The implementation    consists of one    or more     authentica-
  156. tion  servers  running    on  physically    secure    hosts.     The
  157. authentication servers maintain     a  database  of  principals
  158. (i.e.,    users  and  servers)  and  their  secret keys.    Code
  159. libraries provide encryption and implement the Kerberos    pro-
  160. tocol.     In order to add authentication    to its transactions,
  161. a typical network application adds one or two calls  to     the
  162. Kerberos  library,  which results in the transmission of the
  163. necessary messages to achieve authentication.
  164.  
  165.      The Kerberos protocol consists of several sub-protocols
  166. (or exchanges).     There are two methods by which    a client can
  167. ask  a    Kerberos  server  for  credentials.   In  the  first
  168. approach,  the client sends a cleartext    request    for a ticket
  169. for the    desired     server     to  the  AS.    The  reply  is    sent
  170. encrypted  in the client's secret key.    Usually    this request
  171. is for a ticket-granting ticket    (TGT)  which  can  later  be
  172. used  with  the    ticket-granting    server (TGS).  In the second
  173. method,    the client sends a request to the TGS.     The  client
  174. sends  the  TGT     to the    TGS in the same    manner as if it    were
  175. contacting any other application server    which requires    Ker-
  176. beros  credentials.   The  reply is encrypted in the session
  177. key from the TGT.
  178.  
  179.      Once obtained, credentials    may be used  to     verify     the
  180. identity  of  the principals in    a transaction, to ensure the
  181. integrity of messages exchanged    between    them, or to preserve
  182. privacy     of the    messages.  The application is free to choose
  183. whatever protection may    be necessary.
  184.  
  185.      To    verify the identities of the principals    in  a  tran-
  186. saction,  the  client  transmits  the  ticket to the server.
  187. Since the ticket is sent "in the clear"     (parts     of  it     are
  188. encrypted,  but     this  encryption doesn't thwart replay) and
  189. __________________________
  190. its owner knows    it.  Thus, in public key cryptosystems,
  191. one has    a public and a private key.
  192.  
  193.  
  194.  
  195. Section    1.           - 3 -     Expires 15    October    1993
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.           Version 5 - Revision 5.2
  203.  
  204.  
  205. might be intercepted and reused    by an  attacker,  additional
  206. information is sent to prove that the message was originated
  207. by the principal to whom the ticket was    issued.     This infor-
  208. mation    (called     the authenticator) is encrypted in the    ses-
  209. sion key, and includes a timestamp.   The  timestamp  proves
  210. that the message was recently generated    and is not a replay.
  211. Encrypting the authenticator in    the session key    proves    that
  212. it  was     generated  by    a  party possessing the    session    key.
  213. Since no one except the    requesting principal and the  server
  214. know  the  session key (it is never sent over the network in
  215. the clear) this    guarantees the identity    of the client.
  216.  
  217.      The integrity of the messages exchanged between princi-
  218. pals can also be guaranteed using the session key (passed in
  219. the ticket and contained in the    credentials).  This approach
  220. provides detection of both replay attacks and message stream
  221. modification attacks.  It is accomplished by generating     and
  222. transmitting  a    collision-proof    checksum (elsewhere called a
  223. hash or    digest function) of the    client's message, keyed    with
  224. the  session  key.   Privacy  and  integrity of    the messages
  225. exchanged between principals can be  secured  by  encrypting
  226. the  data  to  be passed using the session key passed in the
  227. ticket,    and contained in the credentials.
  228.  
  229.      The authentication    exchanges  mentioned  above  require
  230. read-only  access to the Kerberos database.  Sometimes,    how-
  231. ever, the entries in the database must be modified, such  as
  232. when  adding  new  principals or changing a principal's    key.
  233. This is    done using a protocol between a    client and  a  third
  234. Kerberos  server, the Kerberos Administration Server (KADM).
  235. The administration protocol is not described in     this  docu-
  236. ment.    There  is  also     a protocol for    maintaining multiple
  237. copies of the Kerberos database, but this can be  considered
  238. an  implementation  detail and may vary    to support different
  239. database technologies.
  240.  
  241. 1.1.  Cross-Realm Operation
  242.  
  243.      The Kerberos protocol is  designed     to  operate  across
  244. organizational boundaries.  A client in    one organization can
  245. be authenticated to a server in    another.  Each    organization
  246. wishing     to  run  a  Kerberos  server  establishes  its     own
  247. "realm".  The name  of    the  realm  in    which  a  client  is
  248. registered  is part of the client's name, and can be used by
  249. the end-service    to decide whether to honor a request.
  250.  
  251.      By    establishing "inter-realm" keys, the  administrators
  252. of  two    realms can allow a client authenticated    in the local
  253. realm to use its authentication    remotely[3].   The  exchange
  254. __________________________
  255.  
  256. [3] Of course, with appropriate    permission  the     client
  257. could  arrange registration of a separately-named prin-
  258. cipal in a remote realm, and engage in normal exchanges
  259. with  that  realm's  services.    However, for even small
  260.  
  261. Section    1.1.           - 4 -     Expires 15    October    1993
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.           Version 5 - Revision 5.2
  269.  
  270.  
  271. of inter-realm keys (a separate    key may     be  used  for    each
  272. direction)  registers  the  ticket-granting  service of    each
  273. realm as a principal in    the other realm.  A client  is    then
  274. able  to  obtain  a  ticket-granting  ticket  for the remote
  275. realm's    ticket-granting    service    from its local realm.    When
  276. that  ticket-granting  ticket  is  used,  the remote ticket-
  277. granting service uses the  inter-realm    key  (which  usually
  278. differs     from its own normal TGS key) to decrypt the ticket-
  279. granting ticket, and is    thus certain that it was  issued  by
  280. the  client's own TGS.    Tickets    issued by the remote ticket-
  281. granting service will indicate to the end-service  that     the
  282. client was authenticated from another realm.
  283.  
  284.      A realm is    said to    communicate with  another  realm  if
  285. the  two  realms  share     an inter-realm    key, or    if the local
  286. realm shares an    inter-realm key    with an     intermediate  realm
  287. that  communicates with    the remote realm.  An authentication
  288. path is    the sequence of    intermediate realms that  are  tran-
  289. sited in communicating from one    realm to another.
  290.  
  291.      Realms are    typically  organized  hierarchically.    Each
  292. realm  shares a    key with its parent and    a different key    with
  293. each child.  If    an inter-realm key is not directly shared by
  294. two  realms, the hierarchical organization allows an authen-
  295. tication path to be easily constructed.     If  a    hierarchical
  296. organization  is  not  used,  it may be    necessary to consult
  297. some database in order to construct an    authentication    path
  298. between    realms.
  299.  
  300.      Although realms are typically hierarchical,  intermedi-
  301. ate  realms may    be bypassed to achieve cross-realm authenti-
  302. cation through alternate authentication    paths  (these  might
  303. be established to make communication between two realms    more
  304. efficient).  It    is important for  the  end-service  to    know
  305. which  realms were transited when deciding how much faith to
  306. place in the authentication  process.    To  facilitate    this
  307. decision,  a  field in each ticket contains the    names of the
  308. realms that were involved in authenticating the    client.
  309.  
  310. 1.2.  Environmental assumptions
  311.  
  312. Kerberos imposes a few assumptions  on    the  environment  in
  313. which it can properly function:
  314.  
  315. +    "Denial of    service" attacks are not  solved  with    Ker-
  316.      beros.   There  are  places in these protocols where an
  317.      intruder can prevent an application from  participating
  318.      in     the  proper  authentication  steps.   Detection and
  319.      solution of such attacks (some of which can  appear  to
  320.      be     not-uncommon "normal" failure modes for the system)
  321.      is    usually    best left to the  human     administrators     and
  322. __________________________
  323. numbers    of clients this    becomes     cumbersome,  and  more
  324. automatic methods as described here are    necessary.
  325.  
  326.  
  327. Section    1.2.           - 5 -     Expires 15    October    1993
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.           Version 5 - Revision 5.2
  335.  
  336.  
  337.      users.
  338.  
  339. +    Principals    must keep their    secret keys secret.   If  an
  340.      intruder  somehow    steals a principal's key, it will be
  341.      able to masquerade    as that    principal or impersonate any
  342.      server to the legitimate principal.
  343.  
  344. +    "Password guessing" attacks are not solved    by Kerberos.
  345.      If     a  user chooses a poor    password, it is    possible for
  346.      an    attacker to successfully mount an offline dictionary
  347.      attack  by     repeatedly attempting to decrypt, with    suc-
  348.      cessive entries from a  dictionary,  messages  obtained
  349.      which are encrypted under a key derived from the user's
  350.      password.
  351.  
  352. +    Each host on the network must have     a  clock  which  is
  353.      "loosely  synchronized" to    the time of the    other hosts;
  354.      this synchronization is used to reduce the     bookkeeping
  355.      needs of application servers when they do replay detec-
  356.      tion.  The    degree of "looseness" can be configured    on a
  357.      per-server     basis.     If the    clocks are synchronized    over
  358.      the network, the clock  synchronization  protocol    must
  359.      itself be secured from network attackers.
  360.  
  361. +    Principal identifiers are not recycled on a  short-term
  362.      basis.   A     typical  mode    of  access  control will use
  363.      access control lists (ACLs)  to  grant  permissions  to
  364.      particular     principals.   If  a stale ACL entry remains
  365.      for a deleted principal and the principal identifier is
  366.      reused, the new principal will inherit rights specified
  367.      in    the stale ACL  entry.    By  not     re-using  principal
  368.      identifiers,   the     danger     of  inadvertent  access  is
  369.      removed.
  370.  
  371. 1.3.  Glossary of terms
  372.  
  373. Below is a list    of terms used throughout this document.
  374.  
  375.  
  376. Authentication        Verifying  the  claimed  identity  of  a
  377.             principal.
  378.  
  379.  
  380. Authentication headerA record containing  a  Ticket  and  an
  381.             Authenticator   to    be  presented  to  a
  382.             server as  part  of     the  authentication
  383.             process.
  384.  
  385.  
  386. Authentication path A sequence of intermediate realms  tran-
  387.             sited in the authentication    process    when
  388.             communicating from one realm to another.
  389.  
  390.  
  391.  
  392.  
  393. Section    1.3.           - 6 -     Expires 15    October    1993
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.           Version 5 - Revision 5.2
  401.  
  402.  
  403. Authenticator        A record containing    information that can
  404.             be shown to    have been recently generated
  405.             using the session key known    only by     the
  406.             client and server.
  407.  
  408.  
  409. Authorization        The    process     of  determining  whether  a
  410.             client may use a service,  which objects
  411.             the    client is allowed to access, and the
  412.             type of access allowed for each.
  413.  
  414.  
  415. Capability        A token that grants    the  bearer  permis-
  416.             sion to access an object or    service.  In
  417.             Kerberos, this might be a  ticket  whose
  418.             use    is restricted by the contents of the
  419.             authorization  data     field,     but   which
  420.             lists  no  network    addresses,  together
  421.             with the session key  necessary  to     use
  422.             the    ticket.
  423.  
  424.  
  425. Ciphertext        The    output of  an  encryption  function.
  426.             Encryption     transforms  plaintext    into
  427.             ciphertext.
  428.  
  429.  
  430. Client            A process that makes use  of  a  network
  431.             service  on    behalf of a user.  Note    that
  432.             in some cases a Server may itself  be  a
  433.             client  of    some  other  server  (e.g. a
  434.             print server may be    a client of  a    file
  435.             server).
  436.  
  437.  
  438. Credentials        A ticket plus  the    secret    session     key
  439.             necessary    to   successfully  use    that
  440.             ticket in an authentication    exchange.
  441.  
  442.  
  443. KDC            Key    Distribution Center, a network    ser-
  444.             vice that supplies tickets and temporary
  445.             session keys; or  an  instance  of    that
  446.             service  or     the  host on which it runs.
  447.             The    KDC services both initial ticket and
  448.             ticket-granting  ticket  requests.     The
  449.             initial  ticket  portion  is   sometimes
  450.             referred to    as the Authentication Server
  451.             (or      service).    The   ticket-granting
  452.             ticket  portion is sometimes referred to
  453.             as the ticket-granting server  (or    ser-
  454.             vice).
  455.  
  456.  
  457.  
  458.  
  459. Section    1.3.           - 7 -     Expires 15    October    1993
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.           Version 5 - Revision 5.2
  467.  
  468.  
  469. Kerberos        Aside from    the  3-headed  dog  guarding
  470.             Hades,   the   name      given     to  Project
  471.             Athena's  authentication  service,     the
  472.             protocol  used  by    that service, or the
  473.             code used to implement  the     authentica-
  474.             tion service.
  475.  
  476.  
  477. Plaintext        The    input to an encryption    function  or
  478.             the     output     of  a    decryption function.
  479.             Decryption    transforms  ciphertext    into
  480.             plaintext.
  481.  
  482.  
  483. Principal        A  uniquely     named    client     or   server
  484.             instance  that participates    in a network
  485.             communication.
  486.  
  487.  
  488. Principal identifierThe    name used to uniquely identify    each
  489.             different principal.
  490.  
  491.  
  492. Seal            To encipher    a record containing  several
  493.             fields  in    such  a     way that the fields
  494.             cannot be individually replaced  without
  495.             either  knowledge  of the encryption key
  496.             or leaving evidence    of tampering.
  497.  
  498.  
  499. Secret key        An encryption key shared by    a  principal
  500.             and     the  KDC,  distributed     outside the
  501.             bounds of the system, with a long  life-
  502.             time.   In    the  case  of a    human user's
  503.             principal, the  secret  key     is  derived
  504.             from a password.
  505.  
  506.  
  507. Server            A particular Principal which provides  a
  508.             resource to    network    clients.
  509.  
  510.  
  511. Service            A resource provided    to network  clients;
  512.             often  provided  by    more than one server
  513.             (for example, remote file service).
  514.  
  515.  
  516. Session    key        A temporary    encryption key used  between
  517.             two     principals, with a lifetime limited
  518.             to the duration of a single    login  "ses-
  519.             sion".
  520.  
  521.  
  522. Sub-session key        A temporary    encryption key used  between
  523.  
  524.  
  525. Section    1.3.           - 8 -     Expires 15    October    1993
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.           Version 5 - Revision 5.2
  533.  
  534.  
  535.             two     principals,  selected and exchanged
  536.             by the principals using the    session    key,
  537.             and    with a lifetime    limited    to the dura-
  538.             tion of a single association.
  539.  
  540.  
  541. Ticket            A record that helps    a  client  authenti-
  542.             cate itself    to a server; it    contains the
  543.             client's  identity,     a  session  key,  a
  544.             timestamp,    and  other  information, all
  545.             sealed using the  server's    secret    key.
  546.             It    only serves to authenticate a client
  547.             when  presented  along  with   a   fresh
  548.             Authenticator.
  549.  
  550. 2.  Ticket flag    uses and requests
  551.  
  552. Each Kerberos ticket contains a    set of flags which are    used
  553. to  indicate  various attributes of that ticket.  Most flags
  554. may be requested by a client when the  ticket  is  obtained;
  555. some  are  automatically  turned  on  and  off by a Kerberos
  556. server as required.  The following sections explain what the
  557. various     flags    mean,  and  gives examples of reasons to use
  558. such a flag.
  559.  
  560. 2.1.  Initial and pre-authenticated tickets
  561.  
  562.      The INITIAL flag indicates    that  a     ticket     was  issued
  563. using  the  AS    protocol  and  not issued based    on a ticket-
  564. granting ticket.  Application servers that want     to  require
  565. the  knowledge    of  a  client's    secret key (e.g. a password-
  566. changing program) can insist that this flag be    set  in     any
  567. tickets     they  accept, and thus    be assured that    the client's
  568. key was    recently presented to the application client.
  569.  
  570.      The PRE-AUTHENT and HW-AUTHENT flags  provide  addition
  571. information  about the initial authentication, regardless of
  572. whether    the current ticket was    issued    directly  (in  which
  573. case  INITIAL  will also be set) or issued on the basis    of a
  574. ticket-granting    ticket (in which case the  INITIAL  flag  is
  575. clear,    but the    PRE-AUTHENT and    HW-AUTHENT flags are carried
  576. forward    from the ticket-granting ticket).
  577.  
  578. 2.2.  Invalid tickets
  579.  
  580.      The INVALID flag indicates    that a    ticket    is  invalid.
  581. Application servers must reject    tickets    which have this    flag
  582. set.  A    postdated ticket will  usually    be  issued  in    this
  583. form.    Invalid     tickets must be validated by the KDC before
  584. use, by    presenting them    to the KDC in a    TGS request with the
  585. VALIDATE option    specified.  The    KDC will only validate tick-
  586. ets after their    starttime has  passed.     The  validation  is
  587. required  so  that  postdated tickets which have been stolen
  588. before their starttime can be rendered    permanently  invalid
  589.  
  590.  
  591. Section    2.2.           - 9 -     Expires 15    October    1993
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.           Version 5 - Revision 5.2
  599.  
  600.  
  601. (through a hot-list mechanism).
  602.  
  603. 2.3.  Renewable    tickets
  604.  
  605.      Applications may desire to    hold tickets  which  can  be
  606. valid  for  long  periods of time.  However, this can expose
  607. their  credentials  to    potential  theft  for  equally    long
  608. periods,  and  those stolen credentials    would be valid until
  609. the expiration time of the ticket(s).  Simply  using  short-
  610. lived  tickets    and  obtaining    new  ones periodically would
  611. require    the client to have long-term access  to     its  secret
  612. key, an    even greater risk.  Renewable tickets can be used to
  613. mitigate the consequences of theft.  Renewable tickets    have
  614. two  "expiration  times":  the    first  is  when     the current
  615. instance of the    ticket expires,    and the    second is the latest
  616. permissible  value  for     an  individual    expiration time.  An
  617. application  client  must  periodically     (i.e.     before      it
  618. expires)  present  a  renewable     ticket    to the KDC, with the
  619. RENEW option set in the    KDC request.  The KDC will  issue  a
  620. new  ticket  with  a  new session key and a later expiration
  621. time.  All other fields    of the ticket are left unmodified by
  622. the renewal process.  When the latest permissible expiration
  623. time arrives,  the  ticket  expires  permanently.   At    each
  624. renewal,  the KDC may consult a    hot-list to determine if the
  625. ticket had been    reported stolen    since its last    renewal;  it
  626. will  refuse  to  renew     such  stolen  tickets,    and thus the
  627. usable lifetime    of stolen tickets is reduced.
  628.  
  629.      The RENEWABLE flag    in a ticket is normally    only  inter-
  630. preted    by  the     ticket-granting service (discussed below in
  631. section    3.3).  It can  usually    be  ignored  by     application
  632. servers.   However,  some  particularly     careful application
  633. servers    may wish to disallow renewable tickets.
  634.  
  635.      If    a renewable ticket is not renewed by its  expiration
  636. time, the KDC will not renew the ticket.  The RENEWABLE    flag
  637. is reset by default, but a client may request it be  set  by
  638. setting     the RENEWABLE option in the KRB_AS_REQ    message.  If
  639. it is set, then    the renew-till field in    the ticket  contains
  640. the time after which the ticket    may not    be renewed.
  641.  
  642. 2.4.  Postdated    tickets
  643.  
  644.      Applications may occasionally need     to  obtain  tickets
  645. for  use  much    later,    e.g. a batch submission    system would
  646. need tickets to    be valid at the    time the batch job  is    ser-
  647. viced.     However, it is    dangerous to hold valid    tickets    in a
  648. batch queue, since they    will  be  on-line  longer  and    more
  649. prone  to  theft.  Postdated tickets provide a way to obtain
  650. these tickets from the KDC at job submission  time,  but  to
  651. leave  them "dormant" until they are activated and validated
  652. by a further request of    the KDC.  If  a     ticket     theft    were
  653. reported  in  the  interim, the    KDC would refuse to validate
  654. the ticket, and    the thief would    be foiled.
  655.  
  656.  
  657. Section    2.4.           - 10    -    Expires 15    October    1993
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.           Version 5 - Revision 5.2
  665.  
  666.  
  667.      The MAY-POSTDATE flag in  a  ticket  is  normally    only
  668. interpreted  by     the  ticket-granting  service.     It  can  be
  669. ignored    by application servers.     This flag must    be set in  a
  670. ticket-granting     ticket    in order to issue a postdated ticket
  671. based on the presented ticket.    It is reset by    default;  it
  672. may  be     requested by a    client by setting the ALLOW-POSTDATE
  673. option in the KRB_AS_REQ message.  This    flag does not  allow
  674. a client to obtain a postdated ticket-granting ticket; post-
  675. dated  ticket-granting    tickets     can  only  by    obtained  by
  676. requesting  the     postdating  in    the KRB_AS_REQ message.     The
  677. life (endtime-starttime) of a postdated    ticket will  be     the
  678. remaining  life    of the ticket-granting ticket at the time of
  679. the request, unless the    RENEWABLE option  is  also  set,  in
  680. which  case  it     can be    the full life (endtime-starttime) of
  681. the ticket-granting ticket.  The KDC may limit    how  far  in
  682. the future a ticket may    be postdated.
  683.  
  684.      The POSTDATED flag    indicates that    a  ticket  has    been
  685. postdated.   The  application  server can check    the authtime
  686. field in the ticket to see when    the original  authentication
  687. occurred.   Some  services  may     choose     to reject postdated
  688. tickets, or they may  only  accept  them  within  a  certain
  689. period    after  the  original  authentication.    When the KDC
  690. issues a  POSTDATED  ticket,  it  will    also  be  marked  as
  691. INVALID,  so  that  the     application client must present the
  692. ticket to the KDC to be    validated before use.
  693.  
  694. 2.5.  Proxiable    and proxy tickets
  695.  
  696.      At    times it may be    necessary for a    principal to allow a
  697. service     to perform an operation on its    behalf.     The service
  698. must be    able to    take on    the identity of    the client, but    only
  699. for  a    particular purpose.  A principal can allow a service
  700. to take    on the principal's identity for    a particular purpose
  701. by granting it a proxy.
  702.  
  703.      The PROXIABLE flag    in a ticket is normally    only  inter-
  704. preted    by the ticket-granting service.    It can be ignored by
  705. application servers.  When set,    this flag tells    the  ticket-
  706. granting server    that it    is OK to issue a new ticket (but not
  707. a ticket-granting ticket) with a different  network  address
  708. based on this ticket.  This flag is set    by default.
  709.  
  710.      This flag allows a    client to pass a proxy to  a  server
  711. to perform a remote request on its behalf, e.g.    a print    ser-
  712. vice client can    give the print server a    proxy to access     the
  713. client's  files     on  a    particular  file  server in order to
  714. satisfy    a print    request.
  715.  
  716.      In    order to complicate the    use of    stolen    credentials,
  717. Kerberos  tickets  are usually valid from only those network
  718. addresses specifically included    in the ticket[4].  For    this
  719. __________________________
  720.  
  721. [4] It is permissible to request or issue tickets  with
  722.  
  723. Section    2.5.           - 11    -    Expires 15    October    1993
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.           Version 5 - Revision 5.2
  731.  
  732.  
  733. reason,    a client wishing to grant a proxy must request a new
  734. ticket    valid  for  the    network    address    of the service to be
  735. granted    the proxy.
  736.  
  737.      The PROXY flag is set in a    ticket by the  TGS  when  it
  738. issues    a  proxy ticket.  Application servers may check    this
  739. flag and require additional authentication  from  the  agent
  740. presenting the proxy in    order to provide an audit trail.
  741.  
  742. 2.6.  Forwardable tickets
  743.  
  744.      Authentication forwarding is an instance of  the  proxy
  745. case  where  the  service  is  granted    complete  use of the
  746. client's identity.  An example where it     might    be  used  is
  747. when a user logs in to a remote    system and wants authentica-
  748. tion to    work from that system as if the    login were local.
  749.  
  750.      The FORWARDABLE flag  in  a  ticket  is  normally    only
  751. interpreted  by     the  ticket-granting  service.      It  can be
  752. ignored    by application servers.     The FORWARDABLE flag has an
  753. interpretation similar to that of the PROXIABLE    flag, except
  754. ticket-granting    tickets    may also be  issued  with  different
  755. network    addresses.  This flag is reset by default, but users
  756. may request that it be set by setting the FORWARDABLE option
  757. in  the     AS  request when they request their initial ticket-
  758. granting ticket.
  759.  
  760.      This flag allows for authentication forwarding  without
  761. requiring  the    user to    enter a    password again.     If the    flag
  762. is not set, then authentication    forwarding is not permitted,
  763. but  the  same    end result can still be    achieved if the    user
  764. engages    in  the     AS  exchange  with  the  requested  network
  765. addresses and supplies a password.
  766.  
  767.      The FORWARDED flag    is set by  the    TGS  when  a  client
  768. presents a ticket with the FORWARDABLE flag set    and requests
  769. it be set by specifying    the FORWARDED KDC option and supply-
  770. ing  a    set of addresses for the new ticket.  It is also set
  771. in all tickets issued based on tickets    with  the  FORWARDED
  772. flag set.  Application servers may wish    to process FORWARDED
  773. tickets    differently than non-FORWARDED tickets.
  774.  
  775. 2.7.  Other KDC    options
  776.  
  777.      There are two additional options which may    be set in  a
  778. client's  request of the KDC.  The RENEWABLE-OK    option indi-
  779. cates that the client will accept a renewable  ticket  if  a
  780. ticket with the    requested life cannot otherwise    be provided.
  781. If a ticket with the requested life cannot be provided,    then
  782. the KDC    may issue a renewable ticket with a renew-till equal
  783. __________________________
  784. no network addresses specified,    but we do not recommend
  785. it.
  786.  
  787.  
  788.  
  789. Section    2.7.           - 12    -    Expires 15    October    1993
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.           Version 5 - Revision 5.2
  797.  
  798.  
  799. to the the requested endtime.  The value of  the  renew-till
  800. field  may  still  be  adjusted    by site-determined limits or
  801. limits imposed by the individual principal or server.
  802.  
  803.      The ENC-TKT-IN-SKEY  option  is  honored  only  by     the
  804. ticket-granting    service.  It indicates that the    to-be-issued
  805. ticket for the end server is to    be encrypted in    the  session
  806. key from the additional    ticket-granting    ticket provided    with
  807. the request.  See section 3.3.3    for specific details.
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839. __________________________
  840.  
  841. [5] The    password-changing request must not  be    honored
  842. unless    the requester can provide the old password (the
  843. user's current secret key).   Otherwise,  it  would  be
  844. possible  for  someone to walk up to an    unattended ses-
  845. sion and change    another    user's password.
  846. [6] To authenticate a user logging on to a  local  sys-
  847. tem,  the  credentials    obtained in the    AS exchange may
  848. first be used in a TGS exchange    to  obtain  credentials
  849. for  a    local  server.     Those credentials must    then be
  850. verified by the    local server through successful    comple-
  851. tion of    the Client/Server exchange.
  852.  
  853.  
  854.  
  855. Section    3.1.           - 13    -    Expires 15    October    1993
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.           Version 5 - Revision 5.2
  863.  
  864.  
  865.  
  866. 3.  Message Exchanges
  867.  
  868. The following sections    describe  the  interactions  between
  869. network     clients  and  servers    and the    messages involved in
  870. those exchanges.
  871.  
  872. 3.1.  The Authentication Service Exchange
  873.  
  874.               Summary
  875.       Message direction          Message type    Section
  876.       1. Client    to Kerberos   KRB_AS_REQ      5.4.1
  877.       2. Kerberos to client   KRB_AS_REP or   5.4.2
  878.                   KRB_ERROR          5.9.1
  879.  
  880.  
  881.      The Authentication    Service    (AS)  Exchange    between     the
  882. client and the Kerberos    Authentication Server is usually in-
  883. itiated    by a client when it wishes to obtain  authentication
  884. credentials  for  a  given  server  but     currently  holds no
  885. credentials.  The client's secret key is used for encryption
  886. and decryption.     This exchange is typically used at the    ini-
  887. tiation    of a login session,  to     obtain     credentials  for  a
  888. Ticket-Granting     Server,  which    will subsequently be used to
  889. obtain credentials  for     other    servers     (see  section    3.3)
  890. without     requiring  further  use of the    client's secret    key.
  891. This exchange is also used to request credentials  for    ser-
  892. vices which must not be    mediated through the Ticket-Granting
  893. Service, but rather require a principal's secret  key,    such
  894. as the password-changing service[5].  This exchange does not
  895. by  itself  provide any    assurance of the the identity of the
  896. user[6].
  897.  
  898.      The exchange consists of two messages: KRB_AS_REQ    from
  899. the  client  to     Kerberos,  and     KRB_AS_REP  or    KRB_ERROR in
  900. reply.    The formats for    these messages are described in    sec-
  901. tions 5.4.1, 5.4.2, and    5.9.1.
  902.  
  903.      In    the request, the client    sends (in cleartext) its own
  904. identity  and  the  identity  of  the server for which it is
  905. requesting credentials.     The response, KRB_AS_REP,  contains
  906. a ticket for the client    to present to the server, and a    ses-
  907. sion key that will be shared by    the client and    the  server.
  908. The  session key and additional    information are    encrypted in
  909. the client's secret key.  The  KRB_AS_REP  message  contains
  910. information  which  can     be  used  to detect replays, and to
  911. associate it with the message to which it replies.   Various
  912. errors    can  occur; these are indicated    by an error response
  913. (KRB_ERROR) instead of the KRB_AS_REP response.      The  error
  914. message     is  not encrypted.  The KRB_ERROR message also    con-
  915. tains information which    can be used to associate it with the
  916. message     to which it replies.  The lack    of encryption in the
  917. KRB_ERROR message precludes the    ability    to detect replays or
  918. fabrications of    such messages.
  919.  
  920.  
  921. Section    3.1.           - 14    -    Expires 15    October    1993
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.           Version 5 - Revision 5.2
  929.  
  930.  
  931.      In    the normal case    the authentication server  does     not
  932. know  whether  the client is actually the principal named in
  933. the request.  It simply    sends a     reply    without     knowing  or
  934. caring    whether     they  are  the     same.     This  is acceptable
  935. because    nobody but the principal whose identity    was given in
  936. the  request  will  be    able  to use the reply.    Its critical
  937. information is encrypted in that principal's key.  The    ini-
  938. tial  request supports an optional field that can be used to
  939. pass additional    information that might    be  needed  for     the
  940. initial      exchange.    This  field  may     be  used  for    pre-
  941. authentication    if  desired,  but  the    mechanism   is     not
  942. currently specified.
  943.  
  944. 3.1.1.    Generation of KRB_AS_REQ message
  945.  
  946.      The client    may specify a number of    options    in the    ini-
  947. tial   request.       Among  these     options  are  whether    pre-
  948. authentication is to be     performed;  whether  the  requested
  949. ticket    is  to    be  renewable,    proxiable,  or    forwardable;
  950. whether    it  should  be    postdated  or  allow  postdating  of
  951. derivative  tickets;  and whether a renewable ticket will be
  952. accepted in lieu of a non-renewable ticket if the  requested
  953. ticket    expiration  date  cannot  be  satisfied     by  a    non-
  954. renewable ticket (due to configuration constraints; see    sec-
  955. tion 4).  See section A.1 for pseudocode.
  956.  
  957.      The client    prepares the KRB_AS_REQ    message    and sends it
  958. to the KDC.
  959.  
  960. 3.1.2.    Receipt    of KRB_AS_REQ message
  961.  
  962.      If    all goes well,    processing  the     KRB_AS_REQ  message
  963. will  result  in  the creation of a ticket for the client to
  964. present    to  the     server.   The    format    for  the  ticket  is
  965. described  in section 5.3.1.  The contents of the ticket are
  966. determined as follows.
  967.  
  968. 3.1.3.    Generation of KRB_AS_REP message
  969.  
  970.      The authentication     server     looks    up  the     client     and
  971. server    principals  named in the KRB_AS_REQ in its database,
  972. extracting their respective keys.  If required,     the  server
  973. pre-authenticates the request, and if the pre-authentication
  974. check    fails,     an   error   message     with     the    code
  975. KDC_ERR_PREAUTH_FAILED    is  returned.    If the server cannot
  976. accommodate the    requested encryption type, an error  message
  977. with  code  KDC_ERR_ETYPE_NOSUPP  is returned.    Otherwise it
  978. generates a "random" session key[7].
  979. __________________________
  980.  
  981. [7] "Random" means that, among other things, it     should
  982. be  impossible    to  guess the next session key based on
  983. knowledge of past  session  keys.   This  can  only  be
  984. achieved  in  a    pseudo-random number generator if it is
  985. based on cryptographic principles.  It    would  be  more
  986.  
  987. Section    3.1.3.           - 15    -    Expires 15    October    1993
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.           Version 5 - Revision 5.2
  995.  
  996.  
  997.      If    the requested start time is absent  or    indicates  a
  998. time  in  the past, then the start time    of the ticket is set
  999. to the authentication server's current time. If    it indicates
  1000. a  time    in the future, but the POSTDATED option    has not    been
  1001. specified,  then  the    error    KDC_ERR_CANNOT_POSTDATE      is
  1002. returned.   Otherwise  the  requested  start time is checked
  1003. against    the policy of the  local  realm     (the  administrator
  1004. might  decide  to  prohibit certain types or ranges of post-
  1005. dated tickets),    and if acceptable, the ticket's     start    time
  1006. is  set    as requested and  the INVALID flag is set in the new
  1007. ticket.    The postdated ticket must be validated before use by
  1008. presenting  it    to  the     KDC  after  the start time has    been
  1009. reached.
  1010.  
  1011. The expiration time of the ticket will be set to the minimum
  1012. of the following:
  1013.  
  1014. +The expiration    time (endtime) requested in  the  KRB_AS_REQ
  1015.  message.
  1016.  
  1017. +The ticket's start time plus the maximum allowable lifetime
  1018.  associated  with  the    client principal (the authentication
  1019.  server's database includes a maximum ticket lifetime  field
  1020.  in each principal's record; see section 4).
  1021.  
  1022. +The ticket's start time plus the maximum allowable lifetime
  1023.  associated with the server principal.
  1024.  
  1025. +The ticket's start time plus the maximum  lifetime  set  by
  1026.  the policy of the local realm.
  1027.  
  1028.      If    the requested expiration time minus the     start    time
  1029. (as determined above) is less than a site-determined minimum
  1030. lifetime, an error message with    code KDC_ERR_NEVER_VALID  is
  1031. returned.   If    the requested expiration time for the ticket
  1032. exceeds     what  was  determined    as   above,   and   if     the
  1033. "RENEWABLE-OK"    option    was  requested,    then the "RENEWABLE"
  1034. flag is    set in the new ticket, and the renew-till  value  is
  1035. set  as     if the    "RENEWABLE" option were    requested (the field
  1036. and option names are described fully in    section    5.4.1).
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046. __________________________
  1047. desirable  to use a truly random number    generator, such
  1048. as  one     based    on  measurements  of  random   physical
  1049. phenomena.
  1050.  
  1051.  
  1052.  
  1053. Section    3.1.3.           - 16    -    Expires 15    October    1993
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.           Version 5 - Revision 5.2
  1061.  
  1062.  
  1063. If the    RENEWABLE  option  has    been  requested     or  if     the
  1064. RENEWABLE-OK  option  has been set and a renewable ticket is
  1065. to be issued, then  the     renew-till  field  is    set  to     the
  1066. minimum    of:
  1067.  
  1068. +Its requested value.
  1069.  
  1070. +The start time    of the ticket plus the minimum    of  the     two
  1071.  maximum renewable lifetimes associated    with the principals'
  1072.  database entries.
  1073.  
  1074. +The start time    of the ticket  plus  the  maximum  renewable
  1075.  lifetime set by the policy of the local realm.
  1076.  
  1077.      The flags field of    the new    ticket will have the follow-
  1078. ing  options set if they have been requested and if the    pol-
  1079. icy of the local realm    allows:     FORWARDABLE,  MAY-POSTDATE,
  1080. POSTDATED,  PROXIABLE, RENEWABLE. If the new ticket is post-
  1081. dated (the start time is in the    future),  its  INVALID    flag
  1082. will also be set.
  1083.  
  1084.      If    all of the  above  succeed,  the  server  formats  a
  1085. KRB_AS_REP   message   (see   section  5.4.2),    copying     the
  1086. addresses in the request into the  caddr  of  the  response,
  1087. placing    any required pre-authentication    data into the padata
  1088. of the response, and encrypts the  ciphertext  part  in     the
  1089. client's  key  using  the  requested  encryption method, and
  1090. sends it to the    client.     See section A.2 for pseudocode.
  1091.  
  1092. 3.1.4.    Generation of KRB_ERROR    message
  1093.  
  1094.      Several errors can    occur, and the Authentication Server
  1095. responds  by  returning     an error message, KRB_ERROR, to the
  1096. client,     with  the  error-code    and  e-text  fields  set  to
  1097. appropriate  values.  The error    message    contents and details
  1098. are described in Section 5.9.1.
  1099.  
  1100. 3.1.5.    Receipt    of KRB_AS_REP message
  1101.  
  1102.      If    the reply  message  type  is  KRB_AS_REP,  then     the
  1103. client    verifies  that    the  cname  and    crealm fields in the
  1104. cleartext portion of the reply match what it requested.      If
  1105. any  padata  fields  are present, they may be used to derive
  1106. the proper secret key to decrypt the  message.     The  client
  1107. decrypts the encrypted part of the response using its secret
  1108. key, verifies that the nonce in    the encrypted  part  matches
  1109. the  nonce  it    supplied in its    request    (to detect replays).
  1110. It also    verifies that the sname    and srealm in  the  response
  1111. match  those in    the request, and that the host address field
  1112. is also    correct.  It then stores the  ticket,  session    key,
  1113. start  and expiration times, and other information for later
  1114. use.  The key-expiration field from the     encrypted  part  of
  1115. the  response may be checked to    notify the user    of impending
  1116. key  expiration     (the  client  program    could  then  suggest
  1117.  
  1118.  
  1119. Section    3.1.5.           - 17    -    Expires 15    October    1993
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.           Version 5 - Revision 5.2
  1127.  
  1128.  
  1129. remedial  action,  such     as a password change).     See section
  1130. A.3 for    pseudocode.
  1131.  
  1132.      Proper decryption of the KRB_AS_REP message is not    suf-
  1133. ficient     to verify the identity    of the user; the user and an
  1134. attacker could cooperate to  generate  a  KRB_AS_REP  format
  1135. message     which    decrypts properly but is not from the proper
  1136. KDC.  If the host wishes to verify the identity    of the user,
  1137. it  must require the user to present application credentials
  1138. which can be verified using a  securely-stored    secret    key.
  1139. If  those  credentials can be verified,    then the identity of
  1140. the user can be    assured.
  1141.  
  1142. 3.1.6.    Receipt    of KRB_ERROR message
  1143.  
  1144.      If    the reply message type is KRB_ERROR, then the client
  1145. interprets   it      as   an   error   and      performs  whatever
  1146. application-specific tasks are necessary to recover.
  1147.  
  1148. 3.2.  The Client/Server    Authentication Exchange
  1149.  
  1150.                  Summary
  1151. Message    direction              Message type      Section
  1152. Client to Application server          KRB_AP_REQ      5.5.1
  1153. [optional] Application server to client      KRB_AP_REP or      5.5.2
  1154.                       KRB_ERROR      5.9.1
  1155.  
  1156.  
  1157.      The client/server authentication (CS) exchange is    used
  1158. by  network  applications  to authenticate the client to the
  1159. server    and  vice  versa.   The     client     must  have  already
  1160. acquired  credentials  for  the     server     using the AS or TGS
  1161. exchange.
  1162.  
  1163. 3.2.1.    The KRB_AP_REQ message
  1164.  
  1165.      The  KRB_AP_REQ  contains    authentication     information
  1166. which  should  be  part    of the first message in    an authenti-
  1167. cated transaction.  It contains    a ticket, an  authenticator,
  1168. and  some  additional  bookkeeping  information    (see section
  1169. 5.5.1 for the exact format).  The ticket by itself is insuf-
  1170. ficient     to  authenticate a client, since tickets are passed
  1171. across the network in cleartext[8], so the authenticator  is
  1172. used  to prevent invalid replay    of tickets by proving to the
  1173. server that the    client knows the session key of     the  ticket
  1174. and  thus  is entitled to use it.  The KRB_AP_REQ message is
  1175. referred to elsewhere as the "authentication header."
  1176.  
  1177. __________________________
  1178. [8] Tickets contain both an encrypted  and  unencrypted
  1179. portion,  so  cleartext    here refers to the entire unit,
  1180. which can be copied from one message  and  replayed  in
  1181. another    without    any cryptographic skill.
  1182.  
  1183.  
  1184.  
  1185. Section    3.2.1.           - 18    -    Expires 15    October    1993
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.           Version 5 - Revision 5.2
  1193.  
  1194.  
  1195. 3.2.2.    Generation of a    KRB_AP_REQ message
  1196.  
  1197.      When a client wishes to initiate  authentication  to  a
  1198. server,     it obtains (either through a credentials cache, the
  1199. AS exchange, or    the TGS    exchange) a ticket and    session     key
  1200. for  the desired service.  The client may re-use any tickets
  1201. it holds until they expire.  The client     then  constructs  a
  1202. new  Authenticator  from  the the system time, its name, and
  1203. optionally an  application  specific  checksum,     an  initial
  1204. sequence number    to be used in KRB_SAFE or KRB_PRIV messages,
  1205. and/or a session subkey    to be used  in    negotiations  for  a
  1206. session     key unique to this particular session.     Authentica-
  1207. tors may not be    re-used    and will be rejected if    replayed  to
  1208. a server[9].  If a sequence number is  to  be  included,  it
  1209. should    be  randomly chosen so that even after many messages
  1210. have been exchanged it is not likely to    collide     with  other
  1211. sequence numbers in use.
  1212.  
  1213.      The client    may indicate a requirement of mutual authen-
  1214. tication or the    use of a session-key based ticket by setting
  1215. the appropriate    flag(s)    in the ap-options field    of the    mes-
  1216. sage.
  1217.  
  1218.      The Authenticator is encrypted in the session  key     and
  1219. combined  with    the  ticket  to     form the KRB_AP_REQ message
  1220. which is then sent to the end server along  with  any  addi-
  1221. tional    application-specific  information.   See section A.9
  1222. for pseudocode.
  1223.  
  1224. 3.2.3.    Receipt    of KRB_AP_REQ message
  1225.  
  1226.      Authentication is based on    the server's current time of
  1227. day  (clocks  must be loosely synchronized), the authentica-
  1228. tor, and the ticket.  Several errors are  possible.   If  an
  1229. error  occurs, the server is expected to reply to the client
  1230. with a KRB_ERROR message.  This    message    may be    encapsulated
  1231. in the application protocol if its "raw" form is not accept-
  1232. able to    the protocol.    The  format  of     error    messages  is
  1233. described in section 5.9.1.
  1234.  
  1235.      The algorithm for verifying authentication     information
  1236. is  as    follows.  If the message type is not KRB_AP_REQ, the
  1237. server returns the KRB_AP_ERR_MSG_TYPE error.    If  the     key
  1238. version    indicated by the Ticket    in the KRB_AP_REQ is not one
  1239. the server can use (e.g., it indicates an old key,  and     the
  1240. server    no  longer  possesses  a  copy    of the old key), the
  1241. KRB_AP_ERR_BADKEYVER  error  is     returned.   If      the    USE-
  1242. __________________________
  1243.  
  1244. [9] Note that this can make applications based    on  un-
  1245. reliable transports difficult to code correctly, if the
  1246. transport might    deliver    duplicated messages.   In  such
  1247. cases,    a  new authenticator must be generated for each
  1248. retry.
  1249.  
  1250.  
  1251. Section    3.2.3.           - 19    -    Expires 15    October    1993
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.           Version 5 - Revision 5.2
  1259.  
  1260.  
  1261. SESSION-KEY flag is set    in the ap-options  field,  it  indi-
  1262. cates to the server that the ticket is encrypted in the    ses-
  1263. sion key from the  server's  ticket-granting  ticket  rather
  1264. than its secret    key[10].   Since  it  is  possible  for     the
  1265. server    to  be registered in multiple realms, with different
  1266. keys in    each, the srealm field in the unencrypted portion of
  1267. the ticket in the KRB_AP_REQ is    used to    specify    which secret
  1268. key the    server should  use  to    decrypt     that  ticket.     The
  1269. KRB_AP_ERR_NOKEY  error     code  is  returned  if     the  server
  1270. doesn't    have the proper    key to decipher    the ticket.
  1271.  
  1272.      The ticket     is  decrypted    using  the  version  of     the
  1273. server's  key  specified  by  the ticket.  If the decryption
  1274. routines detect    a modification of the ticket  (each  encryp-
  1275. tion  system  must  provide  safeguards     to  detect modified
  1276. ciphertext; see     section  6),  the  KRB_AP_ERR_BAD_INTEGRITY
  1277. error is returned (chances are good that different keys    were
  1278. used to    encrypt    and decrypt).
  1279.  
  1280.      The authenticator is decrypted using  the    session     key
  1281. extracted from the decrypted ticket.  If decryption shows it
  1282. to have    been modified, the KRB_AP_ERR_BAD_INTEGRITY error is
  1283. returned.   The    name and realm of the client from the ticket
  1284. are compared against the same fields in     the  authenticator.
  1285. If  they  don't     match,     the  KRB_AP_ERR_BADMATCH  error  is
  1286. returned (they might not match,    for example,  if  the  wrong
  1287. session     key  was  used     to encrypt the    authenticator).     The
  1288. addresses in the ticket    (if any) are then  searched  for  an
  1289. address     matching  the    operating-system reported address of
  1290. the client.  If    no match is found or the server     insists  on
  1291. ticket    addresses  but    none  are present in the ticket, the
  1292. KRB_AP_ERR_BADADDR error is returned.
  1293.  
  1294.      If    the local (server) time    and the    client time  in     the
  1295. authenticator  differ  by more than the    allowable clock    skew
  1296. (e.g., 5 minutes), the KRB_AP_ERR_SKEW    error  is  returned.
  1297. If  the     server     name,    along with the client name, time and
  1298. microsecond  fields  from  the     Authenticator     match     any
  1299. recently-seen  such  tuples,  the KRB_AP_ERR_REPEAT error is
  1300. returned[11].  The server must    remember  any  authenticator
  1301. presented  within the allowable    clock skew, so that a replay
  1302. attempt    is guaranteed to fail.    If a server loses  track  of
  1303. any authenticator presented within the allowable clock skew,
  1304. __________________________
  1305.  
  1306. [10] This is used for  user-to-user  authentication  as
  1307. described in  [6].
  1308. [11] Note that the rejection here is restricted    to  au-
  1309. thenticators  from  the     same  principal  to  the  same
  1310. server.     Other client principals communicating with the
  1311. same  server principal should not be have their    authen-
  1312. ticators rejected if the time  and  microsecond     fields
  1313. happen to match    some other client's authenticator.
  1314.  
  1315.  
  1316.  
  1317. Section    3.2.3.           - 20    -    Expires 15    October    1993
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.           Version 5 - Revision 5.2
  1325.  
  1326.  
  1327. it must    reject all requests until the  clock  skew  interval
  1328. has passed.  This assures that any lost    or re-played authen-
  1329. ticators will fall outside the allowable clock skew and     can
  1330. no  longer be successfully replayed (If    this is    not done, an
  1331. attacker could conceivably record the ticket and authentica-
  1332. tor  sent  over     the  network  to a server, then disable the
  1333. client's host, pose as the disabled  host,  and     replay     the
  1334. ticket    and  authenticator  to subvert the authentication.).
  1335. If a sequence number is    provided in the     authenticator,     the
  1336. server    saves it for later use in processing KRB_SAFE and/or
  1337. KRB_PRIV messages.  If    a  subkey  is  present,     the  server
  1338. either    saves  it  for later use or uses it to help generate
  1339. its own    choice for a subkey to be returned in  a  KRB_AP_REP
  1340. message.
  1341.  
  1342.      The server     computes  the    age  of     the  ticket:  local
  1343. (server)  time    minus  the start time inside the Ticket.  If
  1344. the start time is later    than the current time by  more    than
  1345. the  allowable    clock  skew or if the INVALID flag is set in
  1346. the ticket, the    KRB_AP_ERR_TKT_NYV error is returned.    Oth-
  1347. erwise,     if  the current time is later than end    time by    more
  1348. than the allowable clock  skew,     the  KRB_AP_ERR_TKT_EXPIRED
  1349. error is returned.
  1350.  
  1351.      If    all these  checks  succeed  without  an     error,     the
  1352. server    is assured that    the client possesses the credentials
  1353. of the principal named in the ticket and  thus,     the  client
  1354. has  been authenticated    to the server.    See section A.10 for
  1355. pseudocode.
  1356.  
  1357. 3.2.4.    Generation of a    KRB_AP_REP message
  1358.  
  1359.      Typically,    a client's request  will  include  both     the
  1360. authentication    information  and  its initial request in the
  1361. same message, and the server need not  explicitly  reply  to
  1362. the KRB_AP_REQ.     However, if mutual authentication (not    only
  1363. authenticating the client to the server, but also the server
  1364. to  the     client)  is being performed, the KRB_AP_REQ message
  1365. will have MUTUAL-REQUIRED set in its ap-options    field, and a
  1366. KRB_AP_REP  message  is     required  in response.     As with the
  1367. error message, this  message  may  be  encapsulated  in     the
  1368. application  protocol if its "raw" form    is not acceptable to
  1369. the application's protocol.  The timestamp  and     microsecond
  1370. field  used  in    the reply must be the client's timestamp and
  1371. microsecond field (as provided    in  the     authenticator)[12].
  1372. __________________________
  1373.  
  1374. [12] In    the Kerberos version 4 protocol, the  timestamp
  1375. in the reply was the client's timestamp    plus one.  This
  1376. is not necessary in version 5 because  version    5  mes-
  1377. sages are formatted in such a way that it is not possi-
  1378. ble to create the reply    by  judicious  message    surgery
  1379. (even  in  encrypted form) without knowledge of    the ap-
  1380. propriate encryption keys.
  1381.  
  1382.  
  1383. Section    3.2.4.           - 21    -    Expires 15    October    1993
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.           Version 5 - Revision 5.2
  1391.  
  1392.  
  1393. If a sequence number is    to be included,    it  should  be    ran-
  1394. domly  chosen  as  described above for the authenticator.  A
  1395. subkey may be included if the server desires to    negotiate  a
  1396. different  subkey.   The  KRB_AP_REP message is    encrypted in
  1397. the session key    extracted from the ticket.  See    section    A.11
  1398. for pseudocode.
  1399.  
  1400. 3.2.5.    Receipt    of KRB_AP_REP message
  1401.  
  1402.  
  1403.      If    a KRB_AP_REP message is    returned,  the    client    uses
  1404. the  session  key  from     the  credentials  obtained  for the
  1405. server[13] to decrypt the message,  and     verifies  that     the
  1406. timestamp  and microsecond fields match    those in the Authen-
  1407. ticator    it sent    to the server.     If  they  match,  then     the
  1408. client    is assured that    the server is genuine.    The sequence
  1409. number and subkey (if present) are retained for     later    use.
  1410. See section A.12 for pseudocode.
  1411.  
  1412.  
  1413. 3.2.6.    Using the encryption key
  1414.  
  1415.      After the KRB_AP_REQ/KRB_AP_REP exchange has  occurred,
  1416. the  client  and server    share an encryption key    which can be
  1417. used by    the application.  The "true session key" to be    used
  1418. for  KRB_PRIV,    KRB_SAFE, or other application-specific    uses
  1419. may be chosen by the application based on the subkeys in the
  1420. KRB_AP_REP  message  and  the  authenticator[14].   In    some
  1421. cases,    the  use of this session key will be implicit in the
  1422. protocol; in others the    method of use must be chosen from  a
  1423. several    alternatives.  We leave    the protocol negotiations of
  1424. how to use the key (e.g.  selecting an encryption or  check-
  1425. sum type) to the application programmer; the Kerberos proto-
  1426. col does not constrain the implementation options.
  1427.  
  1428.      With  both     the  one-way  and   mutual   authentication
  1429. exchanges,  the    peers should take care not to send sensitive
  1430. information to each other  without  proper  assurances.      In
  1431. particular,  applications  that    require    privacy    or integrity
  1432. should use the KRB_AP_REP or KRB_ERROR    responses  from     the
  1433. server    to  client to assure both client and server of their
  1434. peer's    identity.   If    an  application     protocol   requires
  1435. privacy     of  its  messages,  it    can use    the KRB_PRIV message
  1436. (section 3.5).    The KRB_SAFE message (section  3.4)  can  be
  1437. __________________________
  1438.  
  1439. [13] Note that for encrypting the  KRB_AP_REP  message,
  1440. the sub-session    key is not used, even if present in the
  1441. Authenticator.
  1442. [14] Implementations  of  the protocol may wish    to pro-
  1443. vide routines to choose    subkeys    based on  session  keys
  1444. and  random numbers and    to orchestrate a negotiated key
  1445. to be returned in the KRB_AP_REP message.
  1446.  
  1447.  
  1448.  
  1449. Section    3.2.6.           - 22    -    Expires 15    October    1993
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.           Version 5 - Revision 5.2
  1457.  
  1458.  
  1459. used to    assure integrity.
  1460.  
  1461.  
  1462. 3.3.  The Ticket-Granting Service (TGS)    Exchange
  1463.  
  1464.               Summary
  1465.       Message direction          Message type     Section
  1466.       1. Client    to Kerberos   KRB_TGS_REQ      5.4.1
  1467.       2. Kerberos to client   KRB_TGS_REP or   5.4.2
  1468.                   KRB_ERROR           5.9.1
  1469.  
  1470.  
  1471.      The TGS exchange between  a  client  and  the  Kerberos
  1472. Ticket-Granting     Server     is  initiated    by  a client when it
  1473. wishes to obtain  authentication  credentials  for  a  given
  1474. server    (which    might be registered in a remote    realm),    when
  1475. it wishes to renew or validate an existing ticket,  or    when
  1476. it  wishes to obtain a proxy ticket.  In the first case, the
  1477. client must already have acquired a ticket for    the  Ticket-
  1478. Granting  Service using    the AS exchange    (the ticket-granting
  1479. ticket is usually obtained when    a client initially authenti-
  1480. cates to the system, such as when a user logs in).  The    mes-
  1481. sage format for    the TGS    exchange is almost identical to    that
  1482. for the    AS exchange.  The primary difference is    that encryp-
  1483. tion and decryption in the TGS exchange    does not take  place
  1484. under  the  client's key.  Instead, the    session    key from the
  1485. ticket-granting    ticket or renewable ticket,  or     sub-session
  1486. key  from  an Authenticator is used.  As is the    case for all
  1487. application servers, expired tickets are not accepted by the
  1488. TGS,  so once a    renewable or ticket-granting ticket expires,
  1489. the client must    use a  separate     exchange  to  obtain  valid
  1490. tickets.
  1491.  
  1492.      The TGS exchange consists of two  messages:  A  request
  1493. (KRB_TGS_REQ)  from  the  client  to  the  Kerberos  Ticket-
  1494. Granting Server, and a    reply  (KRB_TGS_REP  or     KRB_ERROR).
  1495. The  KRB_TGS_REQ message includes information authenticating
  1496. the client plus    a request for credentials.  The     authentica-
  1497. tion  information  consists  of     the  authentication  header
  1498. (KRB_AP_REQ) which includes the    client's previously obtained
  1499. ticket-granting,  renewable,  or  invalid  ticket.   In     the
  1500. ticket-granting    ticket and  proxy  cases,  the    request     may
  1501. include     one or    more of: a list    of network addresses, a    col-
  1502. lection    of typed authorization data  to     be  sealed  in     the
  1503. ticket    for  authorization use by the application server, or
  1504. additional tickets (the    use of which are  described  later).
  1505. The  TGS  reply    (KRB_TGS_REP) contains the requested creden-
  1506. tials, encrypted in the    session    key from the ticket-granting
  1507. ticket    or  renewable  ticket,    or  if    present, in the    sub-
  1508. session    key from the Authenticator (part of the     authentica-
  1509. tion  header).    The KRB_ERROR message contains an error    code
  1510. and text explaining what went wrong.  The KRB_ERROR  message
  1511. is not encrypted.  The KRB_TGS_REP message contains informa-
  1512. tion which can be used to detect replays, and  to  associate
  1513.  
  1514.  
  1515. Section    3.3.           - 23    -    Expires 15    October    1993
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.           Version 5 - Revision 5.2
  1523.  
  1524.  
  1525. it with    the message to which it    replies.  The KRB_ERROR    mes-
  1526. sage also contains information which can be used to  associ-
  1527. ate it with the    message    to which it replies, but the lack of
  1528. encryption in the KRB_ERROR message precludes the ability to
  1529. detect replays or fabrications of such messages.
  1530.  
  1531. 3.3.1.    Generation of KRB_TGS_REQ message
  1532.  
  1533.      Before sending a request to  the  ticket-granting    ser-
  1534. vice,  the client must determine in which realm    the applica-
  1535. tion server is    registered[15].      If  the  client  does     not
  1536. already    possess    a ticket-granting ticket for the appropriate
  1537. realm, then one    must be    obtained.  This    is  first  attempted
  1538. by  requesting    a ticket-granting ticket for the destination
  1539. realm from the local Kerberos server (using the     KRB_TGS_REQ
  1540. message     recursively).    The Kerberos server may    return a TGT
  1541. for the    desired    realm in which case one    can proceed.  Alter-
  1542. natively,  the    Kerberos server    may return a TGT for a realm
  1543. which is "closer" to the desired realm    (further  along     the
  1544. standard hierarchical path), in    which case this    step must be
  1545. repeated with a    Kerberos server    in the    realm  specified  in
  1546. the returned TGT.  If neither are returned, then the request
  1547. must be    retried    with a Kerberos    server for a realm higher in
  1548. the  hierarchy.      This request will itself require a ticket-
  1549. granting ticket    for the    higher realm which must    be  obtained
  1550. by recursively applying    these directions.
  1551.  
  1552.  
  1553.      Once the client obtains a    ticket-granting     ticket     for
  1554. the  appropriate realm,    it determines which Kerberos servers
  1555. serve that realm, and  contacts     one.    The  list  might  be
  1556. obtained through a configuration file or network service; as
  1557. long as    the secret keys    exchanged by realms are    kept secret,
  1558. only denial of service results from a false Kerberos server.
  1559.  
  1560.      As    in the AS exchange, the    client may specify a  number
  1561. of  options in the KRB_TGS_REQ message.     The client prepares
  1562. the KRB_TGS_REQ    message, providing an authentication  header
  1563. as  an    element     of the    padata field, and including the    same
  1564. fields as used in the KRB_AS_REQ message along with  several
  1565. optional   fields:   the  enc-authorization-data  field     for
  1566. __________________________
  1567.  
  1568. [15] This can be  accomplished    in  several  ways.   It
  1569. might  be  known beforehand (since the realm is    part of
  1570. the principal identifier), or it might be stored  in  a
  1571. nameserver.   Presently,  however,  this information is
  1572. obtained from a    configuration file.  If    the realm to be
  1573. used  is  obtained from    a nameserver, there is a danger
  1574. of being spoofed if the    nameservice providing the realm
  1575. name  is  not  authenticated.  This might result in the
  1576. use of a realm which has been  compromised,  and  would
  1577. result    in  an attacker's ability to compromise    the au-
  1578. thentication of    the application    server to the client.
  1579.  
  1580.  
  1581. Section    3.3.1.           - 24    -    Expires 15    October    1993
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.           Version 5 - Revision 5.2
  1589.  
  1590.  
  1591. application server use and additional  tickets    required  by
  1592. some options.
  1593.  
  1594.      In    preparing the authentication header, the client     can
  1595. select    a  sub-session key under which the response from the
  1596. Kerberos server    will be    encrypted[16].    If  the     sub-session
  1597. key  is     not  specified,  the  session    key from the ticket-
  1598. granting ticket    will be    used.  If the enc-authorization-data
  1599. is  present, it    must be    encrypted in the sub-session key, if
  1600. present, from the authenticator    portion    of  the     authentica-
  1601. tion  header,  or if not present in the    session    key from the
  1602. ticket-granting    ticket.
  1603.  
  1604.      Once prepared, the    message    is sent    to a Kerberos server
  1605. for the    destination realm.  See    section    A.5 for    pseudocode.
  1606.  
  1607. 3.3.2.    Receipt    of KRB_TGS_REQ message
  1608.  
  1609.      The KRB_TGS_REQ message is    processed in a manner  simi-
  1610. lar to the KRB_AS_REQ message, but there are many additional
  1611. checks to be performed.     First,     the  Kerberos    server    must
  1612. determine which    server the accompanying    ticket is for and it
  1613. must select the    appropriate key    to decrypt it.    For a normal
  1614. KRB_TGS_REQ message, it    will be    for the    ticket granting    ser-
  1615. vice, and the TGS's key    will be    used.  If the TGT was issued
  1616. by  another realm, then    the appropriate    inter-realm key    must
  1617. be used.  If the accompanying ticket is    not a ticket  grant-
  1618. ing  ticket for    the current realm, but is for an application
  1619. server in the current realm, the RENEW,    VALIDATE,  or  PROXY
  1620. options     are  specified     in  the request, and the server for
  1621. which a    ticket is requested  is     the  server  named  in     the
  1622. accompanying ticket, then the KDC will decrypt the ticket in
  1623. the authentication header using    the key    of  the     server     for
  1624. which  it  was    issued.      If  no  ticket can be    found in the
  1625. padata    field,    the  KDC_ERR_PADATA_TYPE_NOSUPP      error      is
  1626. returned.
  1627.  
  1628.      Once the accompanying ticket has  been  decrypted,     the
  1629. user-supplied checksum in the Authenticator must be verified
  1630. against     the  contents    of  the     request,  and    the  message
  1631. rejected  if  the checksums do not match (with an error    code
  1632. of KRB_AP_ERR_MODIFIED)    or if the checksum is not  keyed  or
  1633. not    collision-proof      (with       an     error      code      of
  1634. KRB_AP_ERR_INAPP_CKSUM).  If the checksum type is  not    sup-
  1635. ported,     the  KDC_ERR_SUMTYPE_NOSUPP  error is returned.  If
  1636. the authorization-data are present, they are decrypted using
  1637. the sub-session    key from the Authenticator.
  1638. __________________________
  1639.  
  1640. [16] If    the client selects a sub-session key, care must
  1641. be  taken to ensure the    randomness of the selected sub-
  1642. session    key.  One approach would be to generate    a  ran-
  1643. dom  number  and  XOR  it with the session key from the
  1644. ticket-granting    ticket.
  1645.  
  1646.  
  1647. Section    3.3.2.           - 25    -    Expires 15    October    1993
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.           Version 5 - Revision 5.2
  1655.  
  1656.  
  1657.      If    any of the  decryptions     indicate  failed  integrity
  1658. checks,    the KRB_AP_ERR_BAD_INTEGRITY error is returned.
  1659.  
  1660. 3.3.3.    Generation of KRB_TGS_REP message
  1661.  
  1662.      The KRB_TGS_REP message  shares  its  format  with     the
  1663. KRB_AS_REP  (KRB_KDC_REP),  but     with  its type    field set to
  1664. KRB_TGS_REP.   The  detailed  specification  is     in  section
  1665. 5.4.2.
  1666.  
  1667.      The response will include a ticket     for  the  requested
  1668. server.      The  Kerberos     database is queried to    retrieve the
  1669. record for the requested  server  (including  the  key    with
  1670. which  the ticket will be encrypted).  If the request is for
  1671. a ticket granting ticket for a remote realm, and if  no     key
  1672. is shared with the requested realm, then the Kerberos server
  1673. will select the    realm "closest"    to the requested realm    with
  1674. which it does share a key, and use that    realm instead.    This
  1675. is the only case where the response from the KDC will be for
  1676. a different server than    that requested by the client.
  1677.  
  1678.      By    default, the address field, the     client's  name     and
  1679. realm,    the  list  of  transited realms, the time of initial
  1680. authentication,    the expiration time, and  the  authorization
  1681. data  of  the  newly-issued  ticket  will be copied from the
  1682. ticket-granting    ticket (TGT) or    renewable  ticket.   If     the
  1683. transited  field needs to be updated, but the transited    type
  1684. is  not     supported,  the  KDC_ERR_TRTYPE_NOSUPP      error      is
  1685. returned.
  1686.  
  1687.      If    the request specifies an endtime, then    the  endtime
  1688. of the new ticket is set to the    minimum    of (a) that request,
  1689. (b) the    endtime    from the TGT, and (c) the starttime  of     the
  1690. TGT plus the minimum of    the maximum life for the application
  1691. server and the maximum life for    the local realm    (the maximum
  1692. life  for  the requesting principal was    already    applied    when
  1693. the TGT    was issued).  If the new ticket    is to be a  renewal,
  1694. then the endtime above is replaced by the minimum of (a) the
  1695. value of the renew_till    field of  the  ticket  and  (b)     the
  1696. starttime  for    the  new  ticket  plus    the  life  (endtime-
  1697. starttime) of the old ticket.
  1698.  
  1699.      If    the FORWARDED option has been  requested,  then     the
  1700. resulting ticket will contain the addresses specified by the
  1701. client.     This option will only be honored if the FORWARDABLE
  1702. flag  is  set in the TGT.  The PROXY option is similar;     the
  1703. resulting ticket will contain the addresses specified by the
  1704. client.      It  will  be honored only if the PROXIABLE flag in
  1705. the TGT    is set.     The PROXY option will    not  be     honored  on
  1706. requests for additional    ticket-granting    tickets.
  1707.  
  1708.      If    the requested start time is absent  or    indicates  a
  1709. time  in  the past, then the start time    of the ticket is set
  1710. to  the     authentication     server's  current  time.    If      it
  1711.  
  1712.  
  1713. Section    3.3.3.           - 26    -    Expires 15    October    1993
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.           Version 5 - Revision 5.2
  1721.  
  1722.  
  1723. indicates a time in the    future,    but the    POSTDATED option has
  1724. not been specified or the MAY-POSTDATE flag is    not  set  in
  1725. the TGT, then the error    KDC_ERR_CANNOT_POSTDATE    is returned.
  1726. Otherwise,  if    the  ticket-granting  ticket  has  the    MAY-
  1727. POSTDATE  flag    set, then the resulting    ticket will be post-
  1728. dated and the requested    starttime  is  checked    against     the
  1729. policy of the local realm. If acceptable, the ticket's start
  1730. time is    set as requested, and the INVALID flag is set.     The
  1731. postdated  ticket must be validated before use by presenting
  1732. it to the KDC after the    starttime has  been  reached.    How-
  1733. ever,  in  no case may the starttime, endtime, or renew-till
  1734. time of    a newly-issued postdated ticket     extend     beyond     the
  1735. renew-till time    of the ticket-granting ticket.
  1736.  
  1737.      If    the ENC-TKT-IN-SKEY option has been specified and an
  1738. additional  ticket has been included in    the request, the KDC
  1739. will decrypt the additional ticket using  the  key  for     the
  1740. server    to which the additional    ticket was issued and verify
  1741. that it    is a ticket-granting ticket.  If  the  name  of     the
  1742. requested  server  is  missing from the    request, the name of
  1743. the client in the additional ticket will be used.  Otherwise
  1744. the  name  of  the  requested server will be compared to the
  1745. name of    the client in the  additional  ticket  and  if    dif-
  1746. ferent,     the  request  will  be     rejected.   If     the request
  1747. succeeds, the session key from the additional ticket will be
  1748. used  to  encrypt  the    new ticket that    is issued instead of
  1749. using the key of the server for    which the new ticket will be
  1750. used[17].
  1751.  
  1752.      If    the name  of  the  server  in  the  ticket  that  is
  1753. presented to the KDC as    part of    the authentication header is
  1754. not that of  the  ticket-granting  server  itself,  and     the
  1755. server    is  registered in the realm of the KDC,    If the RENEW
  1756. option is requested, then  the    KDC  will  verify  that     the
  1757. RENEWABLE  flag    is set in the ticket and that the renew_till
  1758. time is    still in the future.   If  the    VALIDATE  option  is
  1759. rqeuested,  the    KDC will check that the    starttime has passed
  1760. and the    INVALID     flag  is  set.      If  the  PROXY  option  is
  1761. requested,  then  the KDC will check that the PROXIABLE    flag
  1762. is set in the ticket.  If the tests succeed,  the  KDC    will
  1763. issue the appropriate new ticket.
  1764.  
  1765.      Whenever a     request  is  made  to    the  ticket-granting
  1766. server,     the  presented     ticket(s) is(are) checked against a
  1767. hot-list of tickets which have been canceled.  This hot-list
  1768. might  be  implemented by storing a range of issue dates for
  1769. "suspect tickets"; if a    presented ticket had an    authtime  in
  1770. __________________________
  1771.  
  1772. [17] This allows easy  implementation  of  user-to-user
  1773. authentication    [6],  which uses ticket-granting ticket
  1774. session    keys in    lieu of    secret server  keys  in     situa-
  1775. tions  where  such secret keys could be    easily comprom-
  1776. ised.
  1777.  
  1778.  
  1779. Section    3.3.3.           - 27    -    Expires 15    October    1993
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.           Version 5 - Revision 5.2
  1787.  
  1788.  
  1789. that range, it would be    rejected.  In  this  way,  a  stolen
  1790. ticket-granting    ticket or renewable ticket cannot be used to
  1791. gain additional    tickets    (renewals  or  otherwise)  once     the
  1792. theft  has been    reported.  Any normal ticket obtained before
  1793. it was reported    stolen will still  be  valid  (because    they
  1794. require     no  interaction with the KDC),    but only until their
  1795. normal expiration time.
  1796.  
  1797.      The ciphertext part of the    response in the     KRB_TGS_REP
  1798. message    is encrypted in    the sub-session    key from the Authen-
  1799. ticator, if  present,  or  the    session     key  key  from     the
  1800. ticket-granting     ticket.   It  is  not    encrypted  using the
  1801. client's  secret  key.     Furthermore,  the  client's   key's
  1802. expiration  date  and the key version number fields are    left
  1803. out since these    values are stored along     with  the  client's
  1804. database  record, and that record is not needed    to satisfy a
  1805. request    based on a ticket-granting ticket.  See    section     A.6
  1806. for pseudocode.
  1807.  
  1808. 3.3.3.1.  Encoding the transited field
  1809.  
  1810.      If    the identity of     the  server  in  the  TGT  that  is
  1811. presented to the KDC as    part of    the authentication header is
  1812. that of    the ticket-granting service, but the TGT was  issued
  1813. from another realm, the    KDC will look up the inter-realm key
  1814. shared with that realm and  use     that  key  to    decrypt     the
  1815. ticket.      If  the  ticket is valid, then the KDC< will honor
  1816. the request, subject to    the constraints     outlined  above  in
  1817. the  section  describing the AS    exchange.  The realm part of
  1818. the client's identity will be taken from the ticket-granting
  1819. ticket.      The  name  of     the  realm  that issued the ticket-
  1820. granting ticket    will be    added to the transited field of     the
  1821. ticket    to  be    issued.     This is accomplished by reading the
  1822. transited field    from the ticket-granting  ticket  (which  is
  1823. treated     as an unordered set of    realm names), adding the new
  1824. realm to the set, then    constructing  and  writing  out     its
  1825. encoded     (shorthand)  form (this may involve a rearrangement
  1826. of the existing    encoding).
  1827.  
  1828.      Note that the ticket-granting service does    not add     the
  1829. name  of  its  own realm.  Instead, its    responsibility is to
  1830. add the    name of    the previous realm.  This prevents  a  mali-
  1831. cious Kerberos server from intentionally leaving out its own
  1832. name (it could,    however, omit other realms' names).
  1833.  
  1834.      The  names     of  neither  the  local   realm   nor     the
  1835. principal's realm are to be included in    the transited field.
  1836. They appear elsewhere in the ticket and    both  are  known  to
  1837. have  taken part in authenticating the principal.  Since the
  1838. endpoints  are    not  included,    both  local  and  single-hop
  1839. inter-realm  authentication result in a    transited field    that
  1840. is empty.
  1841.  
  1842.      Because the name of each realm transited  is  added  to
  1843.  
  1844.  
  1845. Section    3.3.3.1.       - 28    -    Expires 15    October    1993
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.           Version 5 - Revision 5.2
  1853.  
  1854.  
  1855. this  field, it    might potentially be very long.     To decrease
  1856. the length of this field, its  contents     are  encoded.     The
  1857. initially  supported  encoding    is  optimized for the normal
  1858. case of    inter-realm communication: a  hierarchical  arrange-
  1859. ment  of  realms  using     either     domain    or X.500 style realm
  1860. names.    This encoding (called DOMAIN-X500-COMPRESS)  is     now
  1861. described.
  1862.  
  1863.      Realm names in the    transited field    are separated  by  a
  1864. ",".   The ",",    "\", trailing "."s, and    leading    spaces (" ")
  1865. are special characters,    and if they  are  part    of  a  realm
  1866. name,  they must be quoted in the transited field by preced-
  1867. ing them with a    "\".
  1868.  
  1869.      A realm name ending with a    "." is interpreted as  being
  1870. prepended to the previous realm.  For example, we can encode
  1871. traversal of EDU, MIT.EDU,  ATHENA.MIT.EDU,  WASHINGTON.EDU,
  1872. and CS.WASHINGTON.EDU as:
  1873.  
  1874.      "EDU,MIT.,ATHENA.,WASHINGTON.EDU,CS.".
  1875.  
  1876. Note that if ATHENA.MIT.EDU, or    CS.WASHINGTON.EDU were    end-
  1877. points,     that  they would not be included in this field, and
  1878. we would have:
  1879.  
  1880.      "EDU,MIT.,WASHINGTON.EDU"
  1881.  
  1882. A realm    name beginning with a "/" is  interpreted  as  being
  1883. appended to the    previous realm[18].  If    it is  to  stand  by
  1884. itself,     then  it  should be preceded by a space (" ").     For
  1885. example, we can    encode traversal of /COM/HP/APOLLO, /COM/HP,
  1886. /COM, and /COM/DEC as:
  1887.  
  1888.      "/COM,/HP,/APOLLO,    /COM/DEC".
  1889.  
  1890. Like the example above,    if /COM/HP/APOLLO and  /COM/DEC     are
  1891. endpoints,  they  they    would not be included in this field,
  1892. and we would have:
  1893.  
  1894.      "/COM,/HP"
  1895.  
  1896.  
  1897.      A null subfield preceding or following a ","  indicates
  1898. that  all  realms  between  the     previous realm    and the    next
  1899. realm have been    traversed[19].    Thus,  ","  means  that     all
  1900. __________________________
  1901.  
  1902. [18] For the purpose of    appending, the realm  preceding
  1903. the  first  listed  realm  is considered to be the null
  1904. realm ("").
  1905. [19] For the purpose of     interpreting  null  subfields,
  1906. the  client's  realm  is considered to precede those in
  1907. the transited field, and the  server's    realm  is  con-
  1908. sidered    to follow them.
  1909.  
  1910.  
  1911. Section    3.3.3.1.       - 29    -    Expires 15    October    1993
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.           Version 5 - Revision 5.2
  1919.  
  1920.  
  1921. realms along the path between the client and the server    have
  1922. been  traversed.  ",EDU,  /COM,"  means    that that all realms
  1923. from the client's realm    up to EDU (in a    domain style hierar-
  1924. chy) have been traversed, and that everything from /COM    down
  1925. to the server's    realm  in  an  X.500  style  has  also    been
  1926. traversed.  This could occur if    the EDU    realm in one hierar-
  1927. chy shares an inter-realm key directly with the     /COM  realm
  1928. in another hierarchy.
  1929.  
  1930. 3.3.4.    Receipt    of KRB_TGS_REP message
  1931.  
  1932. When the KRB_TGS_REP is    received by the    client,    it  is    pro-
  1933. cessed    in  the     same  manner  as  the KRB_AS_REP processing
  1934. described above.  The primary difference is that the cipher-
  1935. text  part  of the response must be decrypted using the    ses-
  1936. sion key from the ticket-granting  ticket  rather  than     the
  1937. client's secret    key.  See section A.7 for pseudocode.
  1938.  
  1939. 3.4.  The KRB_SAFE Exchange
  1940.  
  1941.      The KRB_SAFE message may be used by  clients  requiring
  1942. the   ability  to  detect  modifications  of  messages    they
  1943. exchange.  It achieves this by including a keyed  collision-
  1944. proof  checksum     of  the user data and some control informa-
  1945. tion.  The checksum is keyed with an encryption    key (usually
  1946. the  last  key negotiated via subkeys, or the session key if
  1947. no negotiation has occured).
  1948.  
  1949. 3.4.1.    Generation of a    KRB_SAFE message
  1950.  
  1951. When an    application wishes to send a  KRB_SAFE    message,  it
  1952. collects  its  data  and the appropriate control information
  1953. and computes a checksum    over them.  The     checksum  algorithm
  1954. should    be some    sort of    keyed one-way hash function (such as
  1955. the RSA-MD5-DES     checksum  algorithm  specified     in  section
  1956. 6.4.5,    or the DES MAC), generated using the sub-session key
  1957. if present, or the session key.     Different algorithms may be
  1958. selected  by  changing    the  checksum  type  in    the message.
  1959. Unkeyed    or non-collision-proof checksums  are  not  suitable
  1960. for this use.
  1961.  
  1962.      The  control  information    for  the  KRB_SAFE   message
  1963. includes  both    a  timestamp  and  a  sequence    number.     The
  1964. designer of an application using the KRB_SAFE  message    must
  1965. choose    at  least  one    of  the    two mechanisms.     This choice
  1966. should be based    on the needs of    the application    protocol.
  1967.  
  1968.      Sequence numbers are useful when all messages sent    will
  1969. be  received  by  one's    peer.  Connection state    is presently
  1970. required to maintain the session  key,    so  maintaining     the
  1971. next  sequence number should not present an additional prob-
  1972. lem.
  1973.  
  1974.      If    the application    protocol  is  expected    to  tolerate
  1975.  
  1976.  
  1977. Section    3.4.1.           - 30    -    Expires 15    October    1993
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.           Version 5 - Revision 5.2
  1985.  
  1986.  
  1987. lost  messages    without     them  being  resent, the use of the
  1988. timestamp is the  appropriate  replay  detection  mechanism.
  1989. Using  timestamps  is  also  the  appropriate  mechanism for
  1990. multi-cast protocols where all of one's    peers share a common
  1991. sub-session  key, but some messages will be sent to a subset
  1992. of one's peers.
  1993.  
  1994.      After computing the checksum, the client then transmits
  1995. the information    and checksum to    the recipient in the message
  1996. format specified in section 5.6.1.
  1997.  
  1998. 3.4.2.    Receipt    of KRB_SAFE message
  1999.  
  2000. When an    application receives a KRB_SAFE    message, it verifies
  2001. it  as    follows.   If  any  error  occurs,  an error code is
  2002. reported for use by the    application.
  2003.  
  2004.      The message is first checked by verifying that the    pro-
  2005. tocol  version and type    fields match the current version and
  2006. KRB_SAFE,   respectively.    A      mismatch    generates       a
  2007. KRB_AP_ERR_BADVERSION  or  KRB_AP_ERR_MSG_TYPE    error.     The
  2008. application verifies that the checksum used is a  collision-
  2009. proof     keyed      checksum,    and   if      it   is   not,   a
  2010. KRB_AP_ERR_INAPP_CKSUM error is     generated.   The  recipient
  2011. verifies  that the operating system's report of    the sender's
  2012. address    matches    the sender's address in    the message, and (if
  2013. a  recipient  address is specified or the recipient requires
  2014. an address) that one of    the recipient's    addresses appears as
  2015. the  recipient's address in the    message.  A failed match for
  2016. either case generates a    KRB_AP_ERR_BADADDR error.  Then     the
  2017. timestamp  and    usec  and/or  the sequence number fields are
  2018. checked.   If  timestamp  and  usec  are  expected  and     not
  2019. present,   or    they   are  present  but  not  current,     the
  2020. KRB_AP_ERR_SKEW    error is generated.   If  the  server  name,
  2021. along with the client name, time and microsecond fields    from
  2022. the Authenticator match    any recently-seen such    tuples,     the
  2023. KRB_AP_ERR_REPEAT  error  is  generated.   If  an  incorrect
  2024. sequence  number  is  included,     or  a    sequence  number  is
  2025. expected  but  not present, the    KRB_AP_ERR_BADORDER error is
  2026. generated.  If neither a timestamp and usec  or     a  sequence
  2027. number is present, a KRB_AP_ERR_MODIFIED error is generated.
  2028. Finally, the checksum is computed over the data    and  control
  2029. information,  and if it    doesn't    match the received checksum,
  2030. a KRB_AP_ERR_MODIFIED error is generated.
  2031.  
  2032.      If    all the    checks succeed,    the application     is  assured
  2033. that the message was generated by its peer and was not modi-
  2034. fied in    transit.
  2035.  
  2036. 3.5.  The KRB_PRIV Exchange
  2037.  
  2038.      The KRB_PRIV message may be used by  clients  requiring
  2039. confidentiality     and  the ability to detect modifications of
  2040. exchanged messages.  It     achieves  this     by  encrypting     the
  2041.  
  2042.  
  2043. Section    3.5.           - 31    -    Expires 15    October    1993
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.           Version 5 - Revision 5.2
  2051.  
  2052.  
  2053. messages and adding control information.
  2054.  
  2055. 3.5.1.    Generation of a    KRB_PRIV message
  2056.  
  2057. When an    application wishes to send a  KRB_PRIV    message,  it
  2058. collects  its  data  and the appropriate control information
  2059. (specified in section 5.7.1)  and  encrypts  them  under  an
  2060. encryption key (usually    the last key negotiated    via subkeys,
  2061. or the session key if no negotiation has occured).  As    part
  2062. of  the     control  information, the client must choose to use
  2063. either a timestamp or a    sequence number    (or both);  see     the
  2064. discussion  in section 3.4.1 for guidelines on which to    use.
  2065. After the user data and    control    information  are  encrypted,
  2066. the  client  transmits    the  ciphertext     and some "envelope"
  2067. information to the recipient.
  2068.  
  2069. 3.5.2.    Receipt    of KRB_PRIV message
  2070.  
  2071. When an    application receives a KRB_PRIV    message, it verifies
  2072. it  as    follows.   If  any  error  occurs,  an error code is
  2073. reported for use by the    application.
  2074.  
  2075.      The message is first checked by verifying that the    pro-
  2076. tocol  version and type    fields match the current version and
  2077. KRB_PRIV,   respectively.    A      mismatch    generates       a
  2078. KRB_AP_ERR_BADVERSION  or  KRB_AP_ERR_MSG_TYPE    error.     The
  2079. application then decrypts the ciphertext and  processes     the
  2080. resultant  plaintext.    If decryption shows the    data to    have
  2081. been modified,    a  KRB_AP_ERR_BAD_INTEGRITY  error  is    gen-
  2082. erated.      The recipient    verifies that the operating system's
  2083. report of the sender's address matches the sender's  address
  2084. in  the    message, and (if a recipient address is    specified or
  2085. the  recipient    requires  an  address)    that  one   of     the
  2086. recipient's  addresses appears as the recipient's address in
  2087. the message.  A    failed match for  either  case    generates  a
  2088. KRB_AP_ERR_BADADDR  error.   Then  the    timestamp  and    usec
  2089. and/or the sequence number fields are checked.    If timestamp
  2090. and  usec  are expected    and not    present, or they are present
  2091. but not    current, the KRB_AP_ERR_SKEW error is generated.  If
  2092. the  server  name,  along  with     the  client  name, time and
  2093. microsecond  fields  from  the     Authenticator     match     any
  2094. recently-seen  such  tuples,  the KRB_AP_ERR_REPEAT error is
  2095. generated.  If an incorrect sequence number is included,  or
  2096. a   sequence   number  is  expected  but  not  present,     the
  2097. KRB_AP_ERR_BADORDER error is generated.     If neither a  time-
  2098. stamp    and   usec  or    a  sequence  number  is     present,  a
  2099. KRB_AP_ERR_MODIFIED error is generated.
  2100.  
  2101.      If    all the    checks succeed,    the application     can  assume
  2102. the  message  was  generated  by  its peer, and    was securely
  2103. transmitted (without intruders able to see  the     unencrypted
  2104. contents).
  2105.  
  2106.  
  2107.  
  2108.  
  2109. Section    3.5.2.           - 32    -    Expires 15    October    1993
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.           Version 5 - Revision 5.2
  2117.  
  2118.  
  2119. 3.6.  The KRB_CRED Exchange
  2120.  
  2121.      The KRB_CRED message may be used by  clients  requiring
  2122. the  ability  to  send Kerberos    credentials from one host to
  2123. another.  It achieves this by sending the  tickets  together
  2124. with  encrypted     data  containing the session keys and other
  2125. information associated with the    tickets.
  2126.  
  2127. 3.6.1.    Generation of a    KRB_CRED message
  2128.  
  2129. When an    application wishes to send  a  KRB_CRED     message  it
  2130. first (using the KRB_TGS exchange) obtains credentials to be
  2131. sent to    the remote host.  It then constructs a KRB_CRED    mes-
  2132. sage  using  the  ticket or tickets so obtained, placing the
  2133. session    key needed to use each ticket in the  key  field  of
  2134. the corresponding KrbCredInfo sequence of the encrypted    part
  2135. of the the KRB_CRED message.
  2136.  
  2137.      Other  information     associated  with  each     ticket     and
  2138. obtained  during  the KRB_TGS exchange is also placed in the
  2139. corresponding KrbCredInfo sequence in the encrypted part  of
  2140. the KRB_CRED message.  The current time    and, if    specifically
  2141. required by the    application the     nonce,     s-address,  and  r-
  2142. address     fields,  are  placed  in  the encrypted part of the
  2143. KRB_CRED message which is then encrypted under an encryption
  2144. key previosuly exchanged in the    KRB_AP exchange    (usually the
  2145. last key negotiated via    subkeys, or the    session     key  if  no
  2146. negotiation has    occured).
  2147.  
  2148. 3.6.2.    Receipt    of KRB_CRED message
  2149.  
  2150. When an    application receives a KRB_CRED    message, it verifies
  2151. it.   If any error occurs, an error code is reported for use
  2152. by the application.  The message  is  verified    by  checking
  2153. that  the protocol version and type fields match the current
  2154. version    and KRB_CRED, respectively.  A mismatch    generates  a
  2155. KRB_AP_ERR_BADVERSION  or  KRB_AP_ERR_MSG_TYPE    error.     The
  2156. application then decrypts the ciphertext and  processes     the
  2157. resultant  plaintext.    If decryption shows the    data to    have
  2158. been modified,    a  KRB_AP_ERR_BAD_INTEGRITY  error  is    gen-
  2159. erated.
  2160.  
  2161.      If    present    or required, the recipient verifies that the
  2162. operating  system's  report  of    the sender's address matches
  2163. the sender's address in    the message, and  that    one  of     the
  2164. recipient's  addresses appears as the recipient's address in
  2165. the message.  A    failed match for  either  case    generates  a
  2166. KRB_AP_ERR_BADADDR  error.   The  timestamp  and usec fields
  2167. (and the nonce field if    required) are checked next.  If     the
  2168. timestamp  and usec are    not present, or    they are present but
  2169. not current, the KRB_AP_ERR_SKEW error is generated.
  2170.  
  2171.      If    all the    checks succeed,    the application    stores    each
  2172. of  the     new  tickets  in its ticket cache together with the
  2173.  
  2174.  
  2175. Section    3.6.2.           - 33    -    Expires 15    October    1993
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.           Version 5 - Revision 5.2
  2183.  
  2184.  
  2185. session    key  and  other     information  in  the  corresponding
  2186. KrbCredInfo sequence from the encrypted    part of    the KRB_CRED
  2187. message.
  2188.  
  2189. 4.  The    Kerberos Database
  2190.  
  2191. The Kerberos server must have access to    a database  contain-
  2192. ing  the principal identifiers and secret keys of principals
  2193. to be authenticated[20].
  2194.  
  2195. 4.1.  Database contents
  2196.  
  2197. A database entry  should  contain  at  least  the  following
  2198. fields:
  2199.  
  2200. Field             Value
  2201.  
  2202. name             Principal's            identif-
  2203. ier
  2204. key             Principal's secret    key
  2205. p_kvno             Principal's key version
  2206. max_life         Maximum lifetime for Tickets
  2207. max_renewable_life   Maximum total lifetime for    renewable Tickets
  2208.  
  2209. The name field is an encoding of the principal's identifier.
  2210. The  key  field    contains an encryption key.  This key is the
  2211. principal's secret key.     (The key can  be  encrypted  before
  2212. storage     under a Kerberos "master key" to protect it in    case
  2213. the database is    compromised but    the master key is  not.      In
  2214. that case, an extra field must be added    to indicate the    mas-
  2215. ter key    version    used, see below.) The p_kvno  field  is     the
  2216. key  version  number  of  the  principal's  secret key.     The
  2217. max_life field contains    the maximum allowable lifetime (end-
  2218. time  -    starttime) for any Ticket issued for this principal.
  2219. The max_renewable_life field contains the maximum  allowable
  2220. total  lifetime     for  any  renewable  Ticket issued for    this
  2221. principal.  (See section 3.1 for a description of how  these
  2222. lifetimes  are    used  in determining the lifetime of a given
  2223. Ticket.)
  2224.  
  2225.      A server may provide KDC service to several realms,  as
  2226. long  as the database representation provides a    mechanism to
  2227. distinguish between principal records with identifiers which
  2228. differ only in the realm name.
  2229. __________________________
  2230.  
  2231. [20] The implementation    of the Kerberos    server need not
  2232. combine     the  database    and  the  server  on  the  same
  2233. machine; it is feasible    to store the principal database
  2234. in, say, a network name    service, as long as the    entries
  2235. stored therein are protected  from  disclosure    to  and
  2236. modification  by  unauthorized    parties.   However,  we
  2237. recommend against such strategies,  as    they  can  make
  2238. system management and threat analysis quite complex.
  2239.  
  2240.  
  2241. Section    4.1.           - 34    -    Expires 15    October    1993
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.           Version 5 - Revision 5.2
  2249.  
  2250.  
  2251.      When an application server's key changes, if the change
  2252. is  routine  (i.e.  not     the result of disclosure of the old
  2253. key), the old key should be retained by    the server until all
  2254. tickets     that  had  been issued    using that key have expired.
  2255. Because    of this, it is    possible  for  several    keys  to  be
  2256. active    for  a    single principal.  Ciphertext encrypted    in a
  2257. principal's key    is always tagged with the version of the key
  2258. that was used for encryption, to help the recipient find the
  2259. proper key for decryption.
  2260.  
  2261.      When more than one    key is active for a particular prin-
  2262. cipal,    the  principal will have more than one record in the
  2263. Kerberos database.  The    keys and key  version  numbers    will
  2264. differ    between     the  records (the rest    of the fields may or
  2265. may not    be the same). Whenever Kerberos    issues a ticket,  or
  2266. responds  to  a    request    for initial authentication, the    most
  2267. recent key (known by the Kerberos server) will be  used     for
  2268. encryption.   This  is    the key    with the highest key version
  2269. number.
  2270.  
  2271. 4.2.  Additional fields
  2272.  
  2273. Project    Athena's KDC implementation uses  additional  fields
  2274. in its database:
  2275.  
  2276. Field         Value
  2277.  
  2278. K_kvno         Kerberos' key version
  2279. expiration   Expiration    date for entry
  2280. attributes   Bit field of attributes
  2281. mod_date     Timestamp of last modification
  2282. mod_name     Modifying principal's identifier
  2283.  
  2284.  
  2285. The K_kvno field indicates the key version of  the  Kerberos
  2286. master    key  under  which  the    principal's  secret  key  is
  2287. encrypted.
  2288.  
  2289.      After an entry's expiration date has  passed,  the     KDC
  2290. will  return an    error to any client attempting to gain tick-
  2291. ets as or for the principal.  (A database may want to  main-
  2292. tain  two  expiration  dates: one for the principal, and one
  2293. for the    principal's current key.  This allows password aging
  2294. to  work  independently     of the    principal's expiration date.
  2295. However, due to    the limited space in the responses, the     KDC
  2296. must  combine  the  key     expiration and    principal expiration
  2297. date into a single value called    "key_exp", which is used  as
  2298. a hint to the user to take administrative action.)
  2299.  
  2300.      The attributes field is a bitfield    used to     govern     the
  2301. operations  involving  the  principal.     This field might be
  2302. useful in conjunction with user    registration procedures, for
  2303. site-specific    policy     implementations   (Project   Athena
  2304. currently  uses     it  for  their     user  registration  process
  2305.  
  2306.  
  2307. Section    4.2.           - 35    -    Expires 15    October    1993
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.           Version 5 - Revision 5.2
  2315.  
  2316.  
  2317. controlled by the system-wide database service,    Moira [7]),.
  2318. or to identify the "string to key" conversion algorithm    used
  2319. for a principal's key[21].  Other bits are used    to  indicate
  2320. that certain ticket options should not be allowed in tickets
  2321. encrypted under    a principal's key (one bit each):   Disallow
  2322. issuing     postdated  tickets,  disallow    issuing     forwardable
  2323. tickets, disallow issuing tickets based    on  TGT     authentica-
  2324. tion,  disallow     issuing renewable tickets, disallow issuing
  2325. proxiable tickets, and disallow    issuing     tickets  for  which
  2326. the principal is the server.
  2327.  
  2328.      The mod_date field    contains the time of last  modifica-
  2329. tion  of the entry, and    the mod_name field contains the    name
  2330. of the principal which last modified the entry.
  2331.  
  2332. 4.3.  Frequently Changing Fields
  2333.  
  2334.      Some KDC implementations may wish to maintain the    last
  2335. time  that  a  request    was  made by a particular principal.
  2336. Information that might be maintained includes  the  time  of
  2337. the  last  request,  the  time    of  the     last  request for a
  2338. ticket-granting    ticket,    the  time  of  the  last  use  of  a
  2339. ticket-granting     ticket,  or  other times.  This information
  2340. can then be returned to    the user in the    last-req field    (see
  2341. section    5.2).
  2342.  
  2343.      Other frequently changing information that    can be main-
  2344. tained    is  the     latest    expiration time    for any    tickets    that
  2345. have been issued using each key.  This field would  be    used
  2346. to indicate how    long old keys must remain valid    to allow the
  2347. continued use of outstanding tickets.
  2348.  
  2349. 4.4.  Site Constants
  2350.  
  2351.      The KDC implementation should have    the following confi-
  2352. gurable     constants  or options,    to allow an administrator to
  2353. make and enforce policy    decisions:
  2354.  
  2355. +  The minimum supported lifetime (used    to determine whether
  2356.    the    KDC_ERR_NEVER_VALID error should be returned).    This
  2357.    constant  should  reflect  reasonable   expectations      of
  2358.    round-trip  time  to    the KDC, encryption/decryption time,
  2359.    and processing time by the client and target    server,     and
  2360.    it should allow for a minimum "useful" lifetime.
  2361.  
  2362. +  The maximum allowable total    (renewable)  lifetime  of  a
  2363.    ticket (renew_till -    starttime).
  2364.  
  2365. +  The maximum allowable lifetime of  a     ticket     (endtime  -
  2366.    starttime).
  2367. __________________________
  2368.  
  2369. [21] See the discussion    of the padata field in    section
  2370. 5.4.2 for details on why this can be useful.
  2371.  
  2372.  
  2373. Section    4.4.           - 36    -    Expires 15    October    1993
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.           Version 5 - Revision 5.2
  2381.  
  2382.  
  2383. +  Whether to allow the    issue of tickets with empty  address
  2384.    fields  (including the ability to specify that such tick-
  2385.    ets may only    be issued  if  the  request  specifies    some
  2386.    authorization_data).
  2387.  
  2388. +  Whether proxiable, forwardable, renewable or    post-datable
  2389.    tickets are to be issued.
  2390.  
  2391.  
  2392. 5.  Message Specifications
  2393.  
  2394.      The following sections describe the exact contents     and
  2395. encoding  of  protocol messages    and objects.  The ASN.1    base
  2396. definitions are    presented  in  the  first  subsection.     The
  2397. remaining  subsections specify the protocol objects (tickets
  2398. and authenticators) and    messages.  Specification of  encryp-
  2399. tion  and  checksum  techniques,  and  the fields related to
  2400. them, appear in    section    6.
  2401.  
  2402. 5.1.  ASN.1 Distinguished Encoding Representation
  2403.  
  2404.      All uses of  ASN.1     in  Kerberos  shall  use  the    Dis-
  2405. tinguished  Encoding  Representation of    the data elements as
  2406. described in the X.509 specification, section 8.7  [8].
  2407.  
  2408. 5.2.  ASN.1 Base Definitions
  2409.  
  2410.      The following ASN.1 base definitions are  used  in     the
  2411. rest  of this section.    Note that since    the underscore char-
  2412. acter (_) is not permitted in ASN.1 names, the hyphen (-) is
  2413. used in    its place for the purposes of ASN.1 names.
  2414.  
  2415. Realm ::=        GeneralString
  2416. PrincipalName ::=   SEQUENCE {
  2417.             name-type[0]     INTEGER,
  2418.             name-string[1]   SEQUENCE OF GeneralString
  2419. }
  2420.  
  2421.  
  2422. Kerberos realms    are encoded as GeneralStrings.    Realms shall
  2423. not  contain  a     character  with the code 0 (the ASCII NUL).
  2424. Most realms  will  usually  consist  of     several  components
  2425. separated  by  periods    (.), in    the style of Internet Domain
  2426. Names, or separated by slashes (/) in  the  style  of  X.500
  2427. names.     Acceptable  forms  for    realm names are    specified in
  2428. section    7.  A PrincipalName is    a  typed  sequence  of    com-
  2429. ponents    consisting of the following sub-fields:
  2430.  
  2431. name-type This field specifies the type    of  name  that    fol-
  2432.       lows.      Pre-defined  values  for  this  field     are
  2433.       specified in section 7.2.  The name-type should be
  2434.       treated as a hint.  Ignoring the name    type, no two
  2435.       names    can be the same    (i.e. at least    one  of     the
  2436.       components,  or  the    realm,    must  be different).
  2437.  
  2438.  
  2439. Section    5.2.           - 37    -    Expires 15    October    1993
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.           Version 5 - Revision 5.2
  2447.  
  2448.  
  2449.       This constraint may be eliminated in the future.
  2450.  
  2451. name-stringThis    field encodes a    sequence of components    that
  2452.       form    a name,    each component encoded as a General-
  2453.       String.  Taken together,  a  PrincipalName  and  a
  2454.       Realm     form  a principal identifier.    Most Princi-
  2455.       palNames will    have only a  few  components  (typi-
  2456.       cally    one or two).
  2457.  
  2458.  
  2459.  
  2460.     KerberosTime ::=   GeneralizedTime
  2461.                -- Specifying UTC time zone (Z)
  2462.  
  2463.  
  2464.      The timestamps used in Kerberos are encoded as General-
  2465. izedTimes.   An    encoding shall specify the UTC time zone (Z)
  2466. and  shall  not     include  any  fractional  portions  of     the
  2467. seconds.   It  further    shall  not  include  any separators.
  2468. Example: The only valid    format for UTC time  6    minutes,  27
  2469. seconds    after 9    pm on 6    November 1985 is 19851106210627Z.
  2470.  
  2471.  HostAddress ::=     SEQUENCE  {
  2472.              addr-type[0]          INTEGER,
  2473.              address[1]              OCTET STRING
  2474.  }
  2475.  
  2476.  HostAddresses ::=   SEQUENCE OF SEQUENCE {
  2477.              addr-type[0]          INTEGER,
  2478.              address[1]              OCTET STRING
  2479.  }
  2480.  
  2481.  
  2482.      The host adddress encodings consists of two fields:
  2483.  
  2484. addr-type This field  specifies    the  type  of  address    that
  2485.       follows.   Pre-defined  values  for this field are
  2486.       specified in section 8.1.
  2487.  
  2488.  
  2489. address      This field encodes a single address of type  addr-
  2490.       type.
  2491.  
  2492. The two    forms differ slightly. HostAddress contains  exactly
  2493. one  address;  HostAddresses contains a    sequence of possibly
  2494. many addresses.
  2495.  
  2496. AuthorizationData ::=    SEQUENCE OF SEQUENCE {
  2497.             ad-type[0]         INTEGER,
  2498.             ad-data[1]         OCTET STRING
  2499. }
  2500.  
  2501.  
  2502. ad-data      This    field  contains     authorization    data  to  be
  2503.       interpreted    according   to     the  value  of     the
  2504.  
  2505. Section    5.2.           - 38    -    Expires 15    October    1993
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.           Version 5 - Revision 5.2
  2513.  
  2514.  
  2515.       corresponding    ad-type    field.
  2516.  
  2517. ad-type      This field specifies the format  for    the  ad-data
  2518.       subfield.   All  negative  values are    reserved for
  2519.       local    use.  Non-negative values are  reserved     for
  2520.       registered use.
  2521.  
  2522.         APOptions ::=    BIT STRING {
  2523.                 reserved(0),
  2524.                 use-session-key(1),
  2525.                 mutual-required(2)
  2526.         }
  2527.  
  2528.  
  2529.         TicketFlags ::=      BIT STRING {
  2530.                   reserved(0),
  2531.                   forwardable(1),
  2532.                   forwarded(2),
  2533.                   proxiable(3),
  2534.                   proxy(4),
  2535.                   may-postdate(5),
  2536.                   postdated(6),
  2537.                   invalid(7),
  2538.                   renewable(8),
  2539.                   initial(9),
  2540.                   pre-authent(10),
  2541.                   hw-authent(11)
  2542.         }
  2543.  
  2544.            KDCOptions ::=    BIT STRING {
  2545.                 reserved(0),
  2546.                 forwardable(1),
  2547.                 forwarded(2),
  2548.                 proxiable(3),
  2549.                 proxy(4),
  2550.                 allow-postdate(5),
  2551.                 postdated(6),
  2552.                 unused7(7),
  2553.                 renewable(8),
  2554.                 unused9(9),
  2555.                 unused10(10),
  2556.                 unused11(11),
  2557.                 renewable-ok(27),
  2558.                 enc-tkt-in-skey(28),
  2559.                 renew(30),
  2560.                 validate(31)
  2561.            }
  2562.  
  2563.  
  2564.      LastReq ::=   SEQUENCE    OF SEQUENCE {
  2565.                lr-type[0]        INTEGER,
  2566.                lr-value[1]        KerberosTime
  2567.      }
  2568.  
  2569.  
  2570.  
  2571. Section    5.2.           - 39    -    Expires 15    October    1993
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.           Version 5 - Revision 5.2
  2579.  
  2580.  
  2581. lr-type      This field indicates how  the     following  lr-value
  2582.       field    is to be interpreted.  Negative    values indi-
  2583.       cate that the    information  pertains  only  to     the
  2584.       responding server.  Non-negative values pertain to
  2585.       all servers for the realm.
  2586.  
  2587.       If the lr-type field is zero (0), then no informa-
  2588.       tion is conveyed by the lr-value subfield.  If the
  2589.       absolute value of the    lr-type    field  is  one    (1),
  2590.       then    the  lr-value  subfield     is the    time of    last
  2591.       initial request for a    TGT.  If it is two (2),    then
  2592.       the  lr-value    subfield is the    time of    last initial
  2593.       request.  If it is three (3),     then  the  lr-value
  2594.       subfield  is    the  time  of  issue  for the newest
  2595.       ticket-granting ticket used.    If it is  four    (4),
  2596.       then the lr-value subfield is    the time of the    last
  2597.       renewal.  If it is five  (5),     then  the  lr-value
  2598.       subfield  is    the  time  of  last  request (of any
  2599.       type).
  2600.  
  2601.  
  2602. lr-value  This field contains the time of the last  request.
  2603.       The time must    be interpreted according to the    con-
  2604.       tents    of the accompanying lr-type subfield.
  2605.  
  2606.      See section 6 for the definitions of  Checksum,  Check-
  2607. sumType,  EncryptedData,  EncryptionKey, EncryptionType, and
  2608. KeyType.
  2609.  
  2610.  
  2611. 5.3.  Tickets and Authenticators
  2612.  
  2613.      This section describes the    format and encryption param-
  2614. eters  for  tickets  and  authenticators.   When a ticket or
  2615. authenticator is  included  in    a  protocol  message  it  is
  2616. treated    as an opaque object.
  2617.  
  2618. 5.3.1.    Tickets
  2619.  
  2620.      A ticket is a record that helps a    client    authenticate
  2621. to a service.  A Ticket    contains the following information:
  2622.  
  2623. Ticket ::=              [APPLICATION 1] SEQUENCE {
  2624.                   tkt-vno[0]           INTEGER,
  2625.                   realm[1]               Realm,
  2626.                   sname[2]               PrincipalName,
  2627.                   enc-part[3]           EncryptedData
  2628. }
  2629. -- Encrypted part of ticket
  2630. EncTicketPart ::=          [APPLICATION 3] SEQUENCE {
  2631.                   flags[0]               TicketFlags,
  2632.                   key[1]               EncryptionKey,
  2633.                   crealm[2]               Realm,
  2634.                   cname[3]               PrincipalName,
  2635.  
  2636.  
  2637. Section    5.3.1.           - 40    -    Expires 15    October    1993
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.           Version 5 - Revision 5.2
  2645.  
  2646.  
  2647.                   transited[4]           TransitedEncoding,
  2648.                   authtime[5]           KerberosTime,
  2649.                   starttime[6]           KerberosTime    OPTIONAL,
  2650.                   endtime[7]           KerberosTime,
  2651.                   renew-till[8]           KerberosTime    OPTIONAL,
  2652.                   caddr[9]               HostAddresses OPTIONAL,
  2653.                   authorization-data[10]       AuthorizationData OPTIONAL
  2654. }
  2655. -- encoded Transited field
  2656. TransitedEncoding ::=          SEQUENCE {
  2657.                   tr-type[0]           INTEGER, -- must be registered
  2658.                   contents[1]           OCTET STRING
  2659. }
  2660.  
  2661. The encoding of    EncTicketPart is encrypted in the key shared
  2662. by  Kerberos  and  the end server (the server's    secret key).
  2663. See section 6 for the format of    the ciphertext.
  2664.  
  2665. tkt-vno      This field specifies the version  number  for     the
  2666.       ticket  format.   This  document describes version
  2667.       number 5.
  2668.  
  2669.  
  2670. realm      This field  specifies     the  realm  that  issued  a
  2671.       ticket.  It also serves to identify the realm    part
  2672.       of the server's  principal  identifier.   Since  a
  2673.       Kerberos server can only issue tickets for servers
  2674.       within its realm, the    two will always     be  identi-
  2675.       cal.
  2676.  
  2677.  
  2678. sname      This field specifies the name    part of    the server's
  2679.       identity.
  2680.  
  2681.  
  2682. enc-part  This field holds the    encrypted  encoding  of     the
  2683.       EncTicketPart    sequence.
  2684.  
  2685.  
  2686. flags      This field indicates which of    various    options    were
  2687.       used    or requested when the ticket was issued.  It
  2688.       is a bit-field, where     the  selected    options     are
  2689.       indicated  by     the  bit  being  set  (1),  and the
  2690.       unselected options and reserved fields being reset
  2691.       (0).     Bit  0     is  the  most significant bit.     The
  2692.       encoding of the bits is specified in section    5.2.
  2693.       The  flags  are  described in    more detail above in
  2694.       section 2.  The meanings of the flags    are:
  2695.  
  2696.  
  2697.       Bit(s) Name          Description
  2698.  
  2699.       0     RESERVED     Reserved for future  expansion  of  this
  2700.                   field.
  2701.  
  2702.  
  2703. Section    5.3.1.           - 41    -    Expires 15    October    1993
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.           Version 5 - Revision 5.2
  2711.  
  2712.  
  2713.       1     FORWARDABLE  The FORWARDABLE flag  is    normally  only
  2714.                   interpreted  by  the  TGS,  and  can  be
  2715.                   ignored by end servers.  When set,  this
  2716.                   flag  tells  the    ticket-granting    server
  2717.                   that it is OK to    issue  a  new  ticket-
  2718.                   granting ticket with a different network
  2719.                   address based on the presented ticket.
  2720.  
  2721.       2     FORWARDED    When set,    this flag indicates  that  the
  2722.                   ticket  has either been forwarded    or was
  2723.                   issued based on authentication involving
  2724.                   a    forwarded ticket-granting ticket.
  2725.  
  2726.       3     PROXIABLE    The  PROXIABLE  flag  is    normally  only
  2727.                   interpreted  by  the  TGS,  and  can  be
  2728.                   ignored by end servers.    The  PROXIABLE
  2729.                   flag  has    an interpretation identical to
  2730.                   that of  the  FORWARDABLE     flag,    except
  2731.                   that   the   PROXIABLE  flag  tells  the
  2732.                   ticket-granting server  that  only  non-
  2733.                   ticket-granting  tickets    may  be    issued
  2734.                   with different network addresses.
  2735.  
  2736.       4     PROXY          When set,    this  flag  indicates  that  a
  2737.                   ticket is    a proxy.
  2738.  
  2739.       5     MAY-POSTDATE The MAY-POSTDATE flag is    normally  only
  2740.                   interpreted  by  the  TGS,  and  can  be
  2741.                   ignored by end servers.  This flag tells
  2742.                   the  ticket-granting server that a post-
  2743.                   dated ticket may be issued based on this
  2744.                   ticket-granting ticket.
  2745.  
  2746.       6     POSTDATED    This flag    indicates that this ticket has
  2747.                   been  postdated.     The  end-service  can
  2748.                   check the    authtime field to see when the
  2749.                   original authentication occurred.
  2750.  
  2751.       7     INVALID      This flag    indicates  that     a  ticket  is
  2752.                   invalid, and it must be validated    by the
  2753.                   KDC  before  use.      Application  servers
  2754.                   must reject tickets which    have this flag
  2755.                   set.
  2756.  
  2757.       8     RENEWABLE    The  RENEWABLE  flag  is    normally  only
  2758.                   interpreted  by the TGS, and can usually
  2759.                   be ignored by end    servers    (some particu-
  2760.                   larly careful servers may    wish to    disal-
  2761.                   low  renewable  tickets).      A  renewable
  2762.                   ticket  can be used to obtain a replace-
  2763.                   ment ticket  that     expires  at  a     later
  2764.                   date.
  2765.  
  2766.  
  2767.  
  2768.  
  2769. Section    5.3.1.           - 42    -    Expires 15    October    1993
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.           Version 5 - Revision 5.2
  2777.  
  2778.  
  2779.       9     INITIAL      This flag    indicates that this ticket was
  2780.                   issued  using  the  AS protocol, and not
  2781.                   issued  based   on   a   ticket-granting
  2782.                   ticket.
  2783.  
  2784.       10     PRE-AUTHENT  This flag    indicates that during  initial
  2785.                   authentication, the client was authenti-
  2786.                   cated by the KDC    before    a  ticket  was
  2787.                   issued.     The   strength     of  the  pre-
  2788.                   authentication method is not  indicated,
  2789.                   but is acceptable    to the KDC.
  2790.  
  2791.       11     HW-AUTHENT   This flag    indicates  that     the  protocol
  2792.                   employed     for   initial    authentication
  2793.                   required the use of hardware expected to
  2794.                   be possessed solely by the named client.
  2795.                   The hardware  authentication  method  is
  2796.                   selected    by the KDC and the strength of
  2797.                   the method is not    indicated.
  2798.  
  2799.       12-31     RESERVED     Reserved for future use.
  2800.  
  2801.  
  2802.  
  2803. key      This field  exists  in  the  ticket  and  the     KDC
  2804.       response  and    is used    to pass    the session key    from
  2805.       Kerberos to the application server and the client.
  2806.       The field's encoding is described in section 6.2.
  2807.  
  2808. crealm      This field contains the name of the realm in which
  2809.       the  client  is  registered  and  in which initial
  2810.       authentication took place.
  2811.  
  2812.  
  2813. cname      This field contains the name part of the  client's
  2814.       principal identifier.
  2815.  
  2816.  
  2817. transited This field lists the names of    the Kerberos  realms
  2818.       that    took part in authenticating the    user to    whom
  2819.       this ticket was issued.  It does not    specify     the
  2820.       order     in  which  the     realms    were transited.     See
  2821.       section 3.3.3.1 for  details    on  how     this  field
  2822.       encodes the traversed    realms.
  2823.  
  2824.  
  2825. authtime  This field indicates the time    of initial authenti-
  2826.       cation for the named principal.  It is the time of
  2827.       issue    for the    original ticket    on which this ticket
  2828.       is based.  It    is included in the ticket to provide
  2829.       additional information to the    end service, and  to
  2830.       provide  the necessary information for implementa-
  2831.       tion of a `hot list' service at the KDC.   An     end
  2832.       service that is particularly paranoid    could refuse
  2833.  
  2834.  
  2835. Section    5.3.1.           - 43    -    Expires 15    October    1993
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.           Version 5 - Revision 5.2
  2843.  
  2844.  
  2845.       to accept tickets for    which the initial  authenti-
  2846.       cation occurred "too far" in the past.
  2847.  
  2848.       This    field  is  also     returned  as  part  of     the
  2849.       response  from  the KDC.  When returned as part of
  2850.       the     response    to       initial    authentication
  2851.       (KRB_AS_REP),    this is    the current time on the    Ker-
  2852.       beros    server[22].
  2853.  
  2854.  
  2855. starttime This field in    the ticket specifies the time  after
  2856.       which    the ticket is valid.  Together with endtime,
  2857.       this field specifies the life    of the    ticket.      If
  2858.       it  is absent    from the ticket, its value should be
  2859.       treated as that of the authtime field.
  2860.  
  2861.  
  2862. endtime      This field  contains    the  time  after  which     the
  2863.       ticket  will not be honored (its expiration time).
  2864.       Note that individual services    may place their     own
  2865.       limits  on  the  life     of  a ticket and may reject
  2866.       tickets which    have not yet expired.  As such,    this
  2867.       is  really  an  upper    bound on the expiration    time
  2868.       for the ticket.
  2869.  
  2870.  
  2871. renew-tillThis field is    only present in     tickets  that    have
  2872.       the  RENEWABLE  flag    set  in    the flags field.  It
  2873.       indicates the    maximum    endtime    that may be included
  2874.       in  a     renewal.  It can be thought of    as the abso-
  2875.       lute expiration time for the ticket, including all
  2876.       renewals.
  2877.  
  2878.  
  2879. caddr      This field in    a ticket contains zero (if  omitted)
  2880.       or  more  (if     present) host addresses.  These are
  2881.       the addresses    from which the ticket can  be  used.
  2882.       If  there are    no addresses, the ticket can be    used
  2883.       from any location.  The decision  by    the  KDC  to
  2884.       issue     or by the end server to accept    zero-address
  2885.       tickets is a policy decision and is  left  to     the
  2886.       Kerberos  and    end-service administrators; they may
  2887.       refuse to issue or accept such tickets.  The    sug-
  2888.       gested  and  default policy, however,    is that    such
  2889.       tickets will only be issued or accepted when addi-
  2890.       tional  information  that  can be used to restrict
  2891.       the  use  of    the  ticket  is     included   in     the
  2892.       authorization_data  field.   Such  a    ticket    is a
  2893. __________________________
  2894.  
  2895. [22] It    is NOT recommended that    this time value    be used
  2896. to adjust the workstation's clock since    the workstation
  2897. cannot reliably    determine that such a KRB_AS_REP  actu-
  2898. ally came from the proper KDC in a timely manner.
  2899.  
  2900.  
  2901. Section    5.3.1.           - 44    -    Expires 15    October    1993
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.           Version 5 - Revision 5.2
  2909.  
  2910.  
  2911.       capability.
  2912.  
  2913.       Network addresses are    included in  the  ticket  to
  2914.       make    it  harder  for     an  attacker  to use stolen
  2915.       credentials.    Because    the session key    is not    sent
  2916.       over    the  network in    cleartext, credentials can't
  2917.       be stolen simply by listening    to the    network;  an
  2918.       attacker  has     to  gain  access to the session key
  2919.       (perhaps   through   operating   system   security
  2920.       breaches  or a careless user's unattended session)
  2921.       to make use of stolen    tickets.
  2922.  
  2923.       It is    important to note that the  network  address
  2924.       from    which  a  connection  is  received cannot be
  2925.       reliably determined.    Even  if  it  could  be,  an
  2926.       attacker who has compromised the client's worksta-
  2927.       tion    could  use  the     credentials   from   there.
  2928.       Including the    network    addresses only makes it    more
  2929.       difficult, not impossible, for an attacker to    walk
  2930.       off with stolen credentials and then use them    from
  2931.       a "safe" location.
  2932.  
  2933.  
  2934. authorization-data
  2935.       The  authorization-data  field  is  used  to    pass
  2936.       authorization     data  from  the  principal on whose
  2937.       behalf a ticket was issued to    the application    ser-
  2938.       vice.      If no    authorization data is included,    this
  2939.       field    will be    left out.  The data  in     this  field
  2940.       are  specific     to the    end service.  It is expected
  2941.       that the field will contain the names     of  service
  2942.       specific objects, and    the rights to those objects.
  2943.       The format for this field is described in  section
  2944.       5.2.     Although Kerberos is not concerned with the
  2945.       format of the    contents of the    subfields,  it    does
  2946.       carry    type information (ad-type).
  2947.  
  2948.       By using the authorization_data field, a principal
  2949.       is  able  to    issue  a  proxy     that is valid for a
  2950.       specific purpose.  For example, a  client  wishing
  2951.       to  print a file can obtain a    file server proxy to
  2952.       be passed to the print server.  By specifying     the
  2953.       name    of the file in the authorization_data field,
  2954.       the file server knows    that the  print     server     can
  2955.       only    use  the  client's rights when accessing the
  2956.       particular file to be    printed.
  2957.  
  2958.       It is    interesting to note that  if  one  specifies
  2959.       the authorization-data field of a proxy and leaves
  2960.       the host addresses blank, the    resulting ticket and
  2961.       session  key    can be treated as a capability.     See
  2962.       [9] for some suggested uses of this field.
  2963.  
  2964.       The authorization-data field is optional and    does
  2965.  
  2966.  
  2967. Section    5.3.1.           - 45    -    Expires 15    October    1993
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.           Version 5 - Revision 5.2
  2975.  
  2976.  
  2977.       not have to be included in a ticket.
  2978.  
  2979. 5.3.2.    Authenticators
  2980.  
  2981.      An    authenticator is a record sent with a  ticket  to  a
  2982. server    to  certify the    client's knowledge of the encryption
  2983. key in the ticket, to help the server detect replays, and to
  2984. help  choose a "true session key" to use with the particular
  2985. session.  The encoding is encrypted in the ticket's  session
  2986. key shared by the client and the server:
  2987.  
  2988. -- Unencrypted authenticator
  2989. Authenticator ::=           [APPLICATION 2] SEQUENCE     {
  2990.                    authenticator-vno[0]         INTEGER,
  2991.                    crealm[1]             Realm,
  2992.                    cname[2]                 PrincipalName,
  2993.                    cksum[3]                 Checksum OPTIONAL,
  2994.                    cusec[4]                 INTEGER,
  2995.                    ctime[5]                 KerberosTime,
  2996.                    subkey[6]             EncryptionKey OPTIONAL,
  2997.                    seq-number[7]             INTEGER OPTIONAL,
  2998.                    authorization-data[8]         AuthorizationData OPTIONAL
  2999. }
  3000.  
  3001.  
  3002. authenticator-vno
  3003.       This field specifies the version  number  for     the
  3004.       format of the    authenticator.    This document speci-
  3005.       fies version 5.
  3006.  
  3007.  
  3008. crealm and cname
  3009.       These    fields are the same as those  described     for
  3010.       the ticket in    section    5.3.1.
  3011.  
  3012.  
  3013. cksum      This field contains a    checksum of the    the applica-
  3014.       tion data that accompanies the KRB_AP_REQ.
  3015.  
  3016.  
  3017. cusec      This field contains the microsecond  part  of     the
  3018.       client's timestamp.  Its value (before encryption)
  3019.       ranges from 0    to 999999.  It often  appears  along
  3020.       with    ctime.     The two fields    are used together to
  3021.       specify a reasonably accurate    timestamp.
  3022.  
  3023.  
  3024. ctime      This    field  contains     the  current  time  on     the
  3025.       client's host.
  3026.  
  3027.  
  3028. subkey      This field contains the  client's  choice  for  an
  3029.       encryption key which is to be    used to    protect    this
  3030.       specific   application   session.    Unless      an
  3031.  
  3032.  
  3033. Section    5.3.2.           - 46    -    Expires 15    October    1993
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.           Version 5 - Revision 5.2
  3041.  
  3042.  
  3043.       application  specifies otherwise, if this field is
  3044.       left out the session key from    the ticket  will  be
  3045.       used.
  3046.  
  3047. seq-numberThis optional    field includes the initial  sequence
  3048.       number to be used by the KRB_PRIV or KRB_SAFE    mes-
  3049.       sages    when sequence numbers  are  used  to  detect
  3050.       replays  (It    may  also  be  used  by     application
  3051.       specific messages).  When included in    the  authen-
  3052.       ticator  this    field specifies    the initial sequence
  3053.       number for messages from the client to the server.
  3054.       When    included  in the AP-REP    message, the initial
  3055.       sequence number is  that  for     messages  from     the
  3056.       server  to  the  client.  When used in KRB_PRIV or
  3057.       KRB_SAFE messages, it    is incremented by one  after
  3058.       each message is sent.
  3059.  
  3060.       For sequence numbers    to  adequately    support     the
  3061.       detection of replays they should be non-repeating,
  3062.       even across connection  boundaries.    The  initial
  3063.       sequence  number  should  be    random and uniformly
  3064.       distributed across  the  full     space    of  possible
  3065.       sequence  numbers, so    that it    cannot be guessed by
  3066.       an attacker and so  that  it    and  the  successive
  3067.       sequence numbers do not repeat other sequences.
  3068.  
  3069.  
  3070. authorization-data
  3071.       This field is    the same as described for the ticket
  3072.       in  section  5.3.1.    It is optional and will    only
  3073.       appear when  additional  restrictions     are  to  be
  3074.       placed  on  the use of a ticket, beyond those    car-
  3075.       ried in the ticket itself.
  3076.  
  3077. 5.4.  Specifications for the AS    and TGS    exchanges
  3078.  
  3079.      This section specifies the    format of the messages    used
  3080. in exchange between the    client and the Kerberos    server.     The
  3081. format of possible error messages appears in section 5.9.1.
  3082.  
  3083. 5.4.1.    KRB_KDC_REQ definition
  3084.  
  3085.      The  KRB_KDC_REQ  message    has  no     type  of  its    own.
  3086. Instead,  its  type  is     one  of  KRB_AS_REQ  or KRB_TGS_REQ
  3087. depending on whether the request is for    an initial ticket or
  3088. an  additional    ticket.     In either case, the message is    sent
  3089. from the client    to  the     Authentication     Server     to  request
  3090. credentials for    a service.
  3091.  
  3092.      The message fields    are:
  3093.  
  3094. AS-REQ ::=       [APPLICATION    10] KDC-REQ
  3095. TGS-REQ    ::=       [APPLICATION    12] KDC-REQ
  3096.  
  3097.  
  3098.  
  3099. Section    5.4.1.           - 47    -    Expires 15    October    1993
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.           Version 5 - Revision 5.2
  3107.  
  3108.  
  3109. KDC-REQ    ::=       SEQUENCE {
  3110.            pvno[1]             INTEGER,
  3111.            msg-type[2]             INTEGER,
  3112.            padata[3]             SEQUENCE OF PA-DATA OPTIONAL,
  3113.            req-body[4]             KDC-REQ-BODY
  3114. }
  3115.  
  3116. PA-DATA    ::=       SEQUENCE {
  3117.            padata-type[1]         INTEGER,
  3118.            padata-value[2]         OCTET STRING,
  3119.                          -- might be encoded AP-REQ
  3120. }
  3121.  
  3122. KDC-REQ-BODY ::=   SEQUENCE {
  3123.             kdc-options[0]         KDCOptions,
  3124.             cname[1]             PrincipalName OPTIONAL,
  3125.                          -- Used only in AS-REQ
  3126.             realm[2]             Realm,    -- Server's realm
  3127.                          -- Also client's in AS-REQ
  3128.             sname[3]             PrincipalName OPTIONAL,
  3129.             from[4]             KerberosTime OPTIONAL,
  3130.             till[5]             KerberosTime,
  3131.             rtime[6]             KerberosTime OPTIONAL,
  3132.             nonce[7]             INTEGER,
  3133.             etype[8]             SEQUENCE OF INTEGER, -- EncryptionType,
  3134.                          -- in preference order
  3135.             addresses[9]         HostAddresses OPTIONAL,
  3136.             enc-authorization-data[10]     EncryptedData OPTIONAL,
  3137.                          -- Encrypted AuthorizationData    encoding
  3138.             additional-tickets[11]     SEQUENCE OF Ticket OPTIONAL
  3139. }
  3140.  
  3141. The fields in this message are:
  3142.  
  3143.  
  3144. pvno      This field is    included in each message, and speci-
  3145.       fies    the  protocol version number.  This document
  3146.       specifies protocol version 5.
  3147.  
  3148.  
  3149. msg-type  This field indicates the type    of a  protocol    mes-
  3150.       sage.      It  will  almost always be the same as the
  3151.       application identifier associated with a  message.
  3152.       It is    included to make the identifier    more readily
  3153.       accessible to    the application.   For    the  KDC-REQ
  3154.       message,   this   type   will      be  KRB_AS_REQ  or
  3155.       KRB_TGS_REQ.
  3156.  
  3157.  
  3158. padata      The padata (pre-authentication  data)     field    con-
  3159.       tains     a  sequence  of  authentication information
  3160.       which    may be    needed    before    credentials  can  be
  3161.       issued  or decrypted.     In the    case of    requests for
  3162.       additional tickets (KRB_TGS_REQ), this field    will
  3163.  
  3164.  
  3165. Section    5.4.1.           - 48    -    Expires 15    October    1993
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.           Version 5 - Revision 5.2
  3173.  
  3174.  
  3175.       include  an element with padata-type of PA-TGS-REQ
  3176.       and data  of    an  authentication  header  (ticket-
  3177.       granting  ticket and authenticator).    The checksum
  3178.       in the authenticator    (which    must  be  collision-
  3179.       proof)  is  to  be  computed over the    KDC-REQ-BODY
  3180.       encoding.  In    most requests for initial  authenti-
  3181.       cation  (KRB_AS_REQ)    and  most replies (KDC-REP),
  3182.       the padata field will    be left    out.
  3183.  
  3184.       This field may also contain information needed  by
  3185.       certain  extensions to the Kerberos protocol.     For
  3186.       example, it might be used to initially verify     the
  3187.       identity  of    a  client  before  any    response  is
  3188.       returned.  This  is  accomplished  with  a  padata
  3189.       field     with  padata-type equal to PA-ENC-TIMESTAMP
  3190.       and padata-value defined as follows:
  3191.  
  3192. padata-type    ::= PA-ENC-TIMESTAMP
  3193. padata-value    ::= EncryptedData -- PA-ENC-TS-ENC
  3194.  
  3195. PA-ENC-TS-ENC    ::= SEQUENCE {
  3196.         patimestamp[0]                 KerberosTime, -- client's time
  3197.         pausec[1]                 INTEGER OPTIONAL
  3198. }
  3199.  
  3200.       with patimestamp containing the client's time     and
  3201.       pausec  containing  the  microseconds    which may be
  3202.       omitted if a client will not    generate  more    than
  3203.       one  request    per second.  The ciphertext (padata-
  3204.       value) consists  of  the  PA-ENC-TS-ENC  sequence,
  3205.       encrypted using the client's secret key.
  3206.  
  3207.       The padata  field  can  also    contain     information
  3208.       needed  to  help  the    KDC or the client select the
  3209.       key  needed  for  generating    or  decrypting     the
  3210.       response.   This  form of the    padata is useful for
  3211.       supporting the use of     certain  "smartcards"    with
  3212.       Kerberos.   The  details  of    such  extensions are
  3213.       beyond the scope of this specification.  See    [10]
  3214.       for additional uses of this field.
  3215.  
  3216. padata-type
  3217.       The padata-type element of the padata    field  indi-
  3218.       cates     the way that the padata-value element is to
  3219.       be interpreted.  Negative  values  of     padata-type
  3220.       are  reserved     for  unregistered use;    non-negative
  3221.       values are used for a    registered interpretation of
  3222.       the element type.
  3223.  
  3224.  
  3225. req-body  This field is    a placeholder delimiting the  extent
  3226.       of  the  remaining fields.  If a checksum is to be
  3227.       calculated over the request, it is calculated    over
  3228.       an  encoding of the KDC-REQ-BODY sequence which is
  3229.  
  3230.  
  3231. Section    5.4.1.           - 49    -    Expires 15    October    1993
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.           Version 5 - Revision 5.2
  3239.  
  3240.  
  3241.       enclosed within the req-body field.
  3242.  
  3243.  
  3244. kdc-options
  3245.       This    field  appears     in   the   KRB_AS_REQ     and
  3246.       KRB_TGS_REQ  requests    to the KDC and indicates the
  3247.       flags    that the client    wants set on the tickets  as
  3248.       well    as  other  information that is to modify the
  3249.       behavior of the KDC.    Where appropriate, the    name
  3250.       of  an  option may be    the same as the    flag that is
  3251.       set by that option.  Although    in  most  case,     the
  3252.       bit  in the options field will be the    same as    that
  3253.       in the flags field, this is not guaranteed, so  it
  3254.       is not acceptable to simply copy the options field
  3255.       to the flags field.  There are various checks    that
  3256.       must be made before honoring an option anyway.
  3257.  
  3258.       The kdc_options field    is a  bit-field,  where     the
  3259.       selected  options  are  indicated by the bit being
  3260.       set (1), and the unselected options  and  reserved
  3261.       fields  being    reset (0).  The    encoding of the    bits
  3262.       is specified in  section  5.2.   The    options     are
  3263.       described  in    more detail above in section 2.     The
  3264.       meanings of the options are:
  3265.  
  3266.       Bit(s)Name           Description
  3267.  
  3268.       0    RESERVED       Reserved    for future  expansion  of  this
  3269.                    field.
  3270.  
  3271.       1    FORWARDABLE    The FORWARDABLE    option    indicates  that
  3272.                    the  ticket  to be issued is to have its
  3273.                    forwardable flag    set.  It  may  only  be
  3274.                    set on the initial request, or in a sub-
  3275.                    sequent request if  the    ticket-granting
  3276.                    ticket on which it is based is also for-
  3277.                    wardable.
  3278.  
  3279.       2    FORWARDED      The FORWARDED option is    only  specified
  3280.                    in  a  request  to  the    ticket-granting
  3281.                    server and will only be honored    if  the
  3282.                    ticket-granting    ticket    in  the    request
  3283.                    has  its     FORWARDABLE  bit  set.       This
  3284.                    option  indicates that this is a    request
  3285.                    for forwarding.    The address(es)    of  the
  3286.                    host  from which    the resulting ticket is
  3287.                    to  be  valid  are   included   in   the
  3288.                    addresses field of the request.
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297. Section    5.4.1.           - 50    -    Expires 15    October    1993
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.           Version 5 - Revision 5.2
  3305.  
  3306.  
  3307.       3    PROXIABLE      The PROXIABLE option indicates that  the
  3308.                    ticket to be issued is to have its prox-
  3309.                    iable flag set.    It may only be    set  on
  3310.                    the  initial request, or    in a subsequent
  3311.                    request if the ticket-granting ticket on
  3312.                    which it    is based is also proxiable.
  3313.  
  3314.       4    PROXY           The PROXY option    indicates that this  is
  3315.                    a request for a proxy.  This option will
  3316.                    only be honored if  the    ticket-granting
  3317.                    ticket  in the request has its PROXIABLE
  3318.                    bit set.     The address(es)  of  the  host
  3319.                    from which the resulting    ticket is to be
  3320.                    valid  are  included  in     the  addresses
  3321.                    field of    the request.
  3322.  
  3323.       5    ALLOW-POSTDATE The ALLOW-POSTDATE option indicates that
  3324.                    the  ticket  to be issued is to have its
  3325.                    MAY-POSTDATE flag set.  It may  only  be
  3326.                    set on the initial request, or in a sub-
  3327.                    sequent request if  the    ticket-granting
  3328.                    ticket on which it is based also    has its
  3329.                    MAY-POSTDATE flag set.
  3330.  
  3331.       6    POSTDATED      The POSTDATED option indicates that this
  3332.                    is  a  request  for  a postdated    ticket.
  3333.                    This option will    only be    honored    if  the
  3334.                    ticket-granting    ticket    on  which it is
  3335.                    based has  its  MAY-POSTDATE  flag  set.
  3336.                    The  resulting ticket will also have its
  3337.                    INVALID flag set, and that flag    may  be
  3338.                    reset by    a subsequent request to    the KDC
  3339.                    after the starttime in  the  ticket  has
  3340.                    been reached.
  3341.  
  3342.       7    UNUSED           This option is presently    unused.
  3343.  
  3344.       8    RENEWABLE      The RENEWABLE option indicates that  the
  3345.                    ticket  to  be  issued  is  to  have its
  3346.                    RENEWABLE flag set.  It may only    be  set
  3347.                    on  the    initial     request,  or  when the
  3348.                    ticket-granting    ticket    on  which   the
  3349.                    request    is based is also renewable.  If
  3350.                    this option is requested, then the rtime
  3351.                    field   in   the     request  contains  the
  3352.                    desired absolute    expiration time    for the
  3353.                    ticket.
  3354.  
  3355.       9-26    RESERVED       Reserved    for future use.
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363. Section    5.4.1.           - 51    -    Expires 15    October    1993
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.           Version 5 - Revision 5.2
  3371.  
  3372.  
  3373.       27    RENEWABLE-OK   The RENEWABLE-OK    option indicates that a
  3374.                    renewable ticket    will be    acceptable if a
  3375.                    ticket with the    requested  life     cannot
  3376.                    otherwise be provided.  If a ticket with
  3377.                    the requested life cannot  be  provided,
  3378.                    then  a    renewable  ticket may be issued
  3379.                    with  a    renew-till  equal  to  the  the
  3380.                    requested  endtime.   The  value     of the
  3381.                    renew-till field    may still be limited by
  3382.                    local  limits, or limits    selected by the
  3383.                    individual principal or server.
  3384.  
  3385.       28    ENC-TKT-IN-SKEYThis option is used only    by the    ticket-
  3386.                    granting     service.   The    ENC-TKT-IN-SKEY
  3387.                    option indicates    that the ticket    for the
  3388.                    end  server  is    to  be encrypted in the
  3389.                    session key from    the additional    ticket-
  3390.                    granting    ticket provided.
  3391.  
  3392.       29    RESERVED       Reserved    for future use.
  3393.  
  3394.       30    RENEW           This option is used only    by the    ticket-
  3395.                    granting      service.   The  RENEW     option
  3396.                    indicates that the  present  request  is
  3397.                    for  a  renewal.     The ticket provided is
  3398.                    encrypted in  the  secret  key  for  the
  3399.                    server  on  which  it  is  valid.   This
  3400.                    option  will  only  be  honored    if  the
  3401.                    ticket  to  be renewed has its RENEWABLE
  3402.                    flag set    and if the time    in  its     renew-
  3403.                    till  field  has    not passed.  The ticket
  3404.                    to be renewed is    passed    in  the     padata
  3405.                    field  as  part    of  the     authentication
  3406.                    header.
  3407.  
  3408.       31    VALIDATE       This option is used only    by the    ticket-
  3409.                    granting     service.   The    VALIDATE option
  3410.                    indicates that the request is  to  vali-
  3411.                    date  a    postdated ticket.  It will only
  3412.                    be honored if the  ticket  presented  is
  3413.                    postdated,  presently  has  its    INVALID
  3414.                    flag set, and would be otherwise     usable
  3415.                    at  this    time.  A ticket    cannot be vali-
  3416.                    dated before its    starttime.  The     ticket
  3417.                    presented for validation    is encrypted in
  3418.                    the key of the server for  which     it  is
  3419.                    valid  and is passed in the padata field
  3420.                    as part of the authentication header.
  3421.  
  3422.  
  3423.  
  3424. cname and sname
  3425.       These    fields are the same as those  described     for
  3426.       the  ticket  in  section 5.3.1.  sname may only be
  3427.  
  3428.  
  3429. Section    5.4.1.           - 52    -    Expires 15    October    1993
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.           Version 5 - Revision 5.2
  3437.  
  3438.  
  3439.       absent when the ENC-TKT-IN-SKEY option  is  speci-
  3440.       fied.      If absent, the name of the server is taken
  3441.       from the name    of the client in the  ticket  passed
  3442.       as additional-tickets.
  3443.  
  3444.  
  3445. enc-authorization-data
  3446.       The enc-authorization-data, if present (and it can
  3447.       only be present in the TGS_REQ form),    is an encod-
  3448.       ing of the  desired  authorization-data  encrypted
  3449.       under     the  sub-session  key    if  present  in     the
  3450.       Authenticator, or alternatively from    the  session
  3451.       key  in  the ticket-granting ticket, both from the
  3452.       padata field in the KRB_AP_REQ.
  3453.  
  3454.  
  3455. realm      This    field  specifies  the  realm  part  of     the
  3456.       server's   principal     identifier.    In   the  AS
  3457.       exchange, this is  also  the    realm  part  of     the
  3458.       client's principal identifier.
  3459.  
  3460.  
  3461. from      This field  is  included  in    the  KRB_AS_REQ     and
  3462.       KRB_TGS_REQ  ticket  requests     when  the requested
  3463.       ticket  is  to  be  postdated.  It  specifies     the
  3464.       desired start    time for the requested ticket.
  3465.  
  3466.  
  3467.  
  3468. till      This field contains the expiration date  requested
  3469.       by the client    in a ticket request.
  3470.  
  3471.  
  3472. rtime      This field is    the requested renew-till  time    sent
  3473.       from    a client to the    KDC in a ticket    request.  It
  3474.       is optional.
  3475.  
  3476.  
  3477. nonce      This    field  is  part     of  the  KDC  request     and
  3478.       response.   It it intended to    hold a random number
  3479.       generated by the client.  If the  same  number  is
  3480.       included  in    the encrypted response from the    KDC,
  3481.       it provides evidence that the     response  is  fresh
  3482.       and  has not been replayed by    an attacker.  Nonces
  3483.       must never be    re-used.  Ideally, it should be    gen-
  3484.       erated randomly, but if the correct time is known,
  3485.       it may suffice[23].
  3486. __________________________
  3487.  
  3488. [23] Note, however, that if the    time  is  used    as  the
  3489. nonce,    one must make sure that    the workstation    time is
  3490. monotonically increasing.  If the time    is  ever  reset
  3491. backwards,  there  is  a small,    but finite, probability
  3492. that a nonce will be reused.
  3493.  
  3494.  
  3495. Section    5.4.1.           - 53    -    Expires 15    October    1993
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.           Version 5 - Revision 5.2
  3503.  
  3504.  
  3505. etype      This field specifies the desired encryption  algo-
  3506.       rithm    to be used in the response.
  3507.  
  3508.  
  3509. addresses This field is    included in the    initial    request     for
  3510.       tickets,  and     optionally included in    requests for
  3511.       additional  tickets    from   the   ticket-granting
  3512.       server.  It specifies    the addresses from which the
  3513.       requested ticket is  to  be  valid.    Normally  it
  3514.       includes  the    addresses for the client's host.  If
  3515.       a proxy is  requested,  this    field  will  contain
  3516.       other     addresses.   The contents of this field are
  3517.       usually copied by the    KDC into the caddr field  of
  3518.       the resulting    ticket.
  3519.  
  3520.  
  3521. additional-tickets
  3522.       Additional tickets may be optionally included    in a
  3523.       request  to  the  ticket-granting  server.  If the
  3524.       ENC-TKT-IN-SKEY option has  been  specified,    then
  3525.       the session key from the additional ticket will be
  3526.       used in place    of the server's    key to    encrypt     the
  3527.       new    ticket.      If  more  than  one  option  which
  3528.       requires additional tickets  has  been  specified,
  3529.       then    the additional tickets are used    in the order
  3530.       specified by the ordering of the options bits    (see
  3531.       kdc-options, above).
  3532.  
  3533.  
  3534.      The application code will be either ten (10) or  twelve
  3535. (12)  depending     on  whether  the  request is for an initial
  3536. ticket (AS-REQ)    or for an additional ticket (TGS-REQ).
  3537.  
  3538.      The optional fields (addresses, authorization-data     and
  3539. additional-tickets)  are  only included    if necessary to    per-
  3540. form the operation specified in    the kdc-options    field.
  3541.  
  3542.      It    should be noted    that in     KRB_TGS_REQ,  the  protocol
  3543. version    number appears twice and two different message types
  3544. appear:     the KRB_TGS_REQ message contains  these  fields  as
  3545. does  the  authentication header (KRB_AP_REQ) that is passed
  3546. in the padata field.
  3547.  
  3548. 5.4.2.    KRB_KDC_REP definition
  3549.  
  3550.      The KRB_KDC_REP message format is used  for  the  reply
  3551. from  the KDC for either an initial (AS) request or a subse-
  3552. quent  (TGS)  request.     There    is  no    message      type     for
  3553. KRB_KDC_REP.  Instead, the type    will be    either KRB_AS_REP or
  3554. KRB_TGS_REP.  The key used to encrypt the ciphertext part of
  3555. the  reply depends on the message type.     For KRB_AS_REP, the
  3556. ciphertext is encrypted    in the client's    secret key, and     the
  3557. client's  key  version number is included in the key version
  3558. number    for  the  encrypted  data.   For  KRB_TGS_REP,     the
  3559.  
  3560.  
  3561. Section    5.4.2.           - 54    -    Expires 15    October    1993
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.           Version 5 - Revision 5.2
  3569.  
  3570.  
  3571. ciphertext  is    encrypted  in  the  sub-session    key from the
  3572. Authenticator, or  if  absent,    the  session  key  from     the
  3573. ticket-granting     ticket     used in the request.  In that case,
  3574. no version number  will     be  present  in  the  EncryptedData
  3575. sequence.
  3576.  
  3577.      The KRB_KDC_REP message contains the following fields:
  3578.  
  3579. AS-REP ::=    [APPLICATION 11] KDC-REP
  3580. TGS-REP    ::=   [APPLICATION 13] KDC-REP
  3581.  
  3582. KDC-REP    ::=   SEQUENCE {
  3583.           pvno[0]             INTEGER,
  3584.           msg-type[1]         INTEGER,
  3585.           padata[2]             SEQUENCE OF PA-DATA OPTIONAL,
  3586.           crealm[3]             Realm,
  3587.           cname[4]             PrincipalName,
  3588.           ticket[5]             Ticket,
  3589.           enc-part[6]         EncryptedData
  3590. }
  3591.  
  3592.  
  3593. EncASRepPart ::=    [APPLICATION 25[25]] EncKDCRepPart
  3594. EncTGSRepPart ::=   [APPLICATION 26] EncKDCRepPart
  3595.  
  3596. EncKDCRepPart ::=   SEQUENCE {
  3597.             key[0]                 EncryptionKey,
  3598.             last-req[1]                 LastReq,
  3599.             nonce[2]                 INTEGER,
  3600.             key-expiration[3]             KerberosTime OPTIONAL,
  3601.             flags[4]                 TicketFlags,
  3602.             authtime[5]                 KerberosTime,
  3603.             starttime[6]             KerberosTime OPTIONAL,
  3604.             endtime[7]                 KerberosTime,
  3605.             renew-till[8]             KerberosTime OPTIONAL,
  3606.             srealm[9]                 Realm,
  3607.             sname[10]                 PrincipalName,
  3608.             caddr[11]                 HostAddresses OPTIONAL
  3609. }
  3610.  
  3611.  
  3612. pvno and msg-type
  3613.       These    fields are described above in section 5.4.1.
  3614.       msg-type is either KRB_AS_REP    or KRB_TGS_REP.
  3615.  
  3616.  
  3617. padata      This field  is  described  in     detail     in  section
  3618.       5.4.1.   One    possible  use  for  this field is to
  3619.       encode an alternate "mix-in"    string    to  be    used
  3620. __________________________
  3621.  
  3622. [25] An    application code in the     encrypted  part  of  a
  3623. message     provides  an additional check that the    message
  3624. was decrypted properly.
  3625.  
  3626.  
  3627. Section    5.4.2.           - 55    -    Expires 15    October    1993
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.           Version 5 - Revision 5.2
  3635.  
  3636.  
  3637.       with    a  string-to-key  algorithm  (such   as      is
  3638.       described in section 6.3.2).    This ability is    use-
  3639.       ful to ease transitions if a realm name  needs  to
  3640.       change  (e.g.    when a company is acquired); in    such
  3641.       a case all existing  password-derived     entries  in
  3642.       the  KDC  database  would  be    flagged    as needing a
  3643.       special mix-in  string  until     the  next  password
  3644.       change.
  3645.  
  3646.  
  3647. crealm,    cname, srealm and sname
  3648.       These    fields are the same as those  described     for
  3649.       the ticket in    section    5.3.1.
  3650.  
  3651.  
  3652. ticket      The newly-issued ticket, from    section    5.3.1.
  3653.  
  3654.  
  3655. enc-part  This field is    a place    holder    for  the  ciphertext
  3656.       and  related    information that forms the encrypted
  3657.       part    of  a  message.      The  description  of     the
  3658.       encrypted part of the    message    follows    each appear-
  3659.       ance of this field.  The encrypted part is encoded
  3660.       as described in section 6.1.
  3661.  
  3662.  
  3663. key      This field is    the same as described for the ticket
  3664.       in section 5.3.1.
  3665.  
  3666.  
  3667. last-req  This field is    returned by the     KDC  and  specifies
  3668.       the  time(s)    of  the    last request by    a principal.
  3669.       Depending on what information    is  available,    this
  3670.       might     be  the  last    time  that  a  request for a
  3671.       ticket-granting ticket was made, or the last    time
  3672.       that    a  request based on a ticket-granting ticket
  3673.       was successful.  It also might cover    all  servers
  3674.       for  a realm,    or just    the particular server.    Some
  3675.       implementations may display  this  information  to
  3676.       the user to aid in discovering unauthorized use of
  3677.       one's    identity.  It is similar in  spirit  to     the
  3678.       last     login    time  displayed     when  logging    into
  3679.       timesharing systems.
  3680.  
  3681.  
  3682. nonce      This field is    described above    in section 5.4.1.
  3683.  
  3684.  
  3685. key-expiration
  3686.       The key-expiration field is part of  the  response
  3687.       from    the  KDC  and  specifies  the  time that the
  3688.       client's secret key is due to    expire.     The expira-
  3689.       tion    might  be the result of    password aging or an
  3690.       account expiration.  This field  will     usually  be
  3691.  
  3692.  
  3693. Section    5.4.2.           - 56    -    Expires 15    October    1993
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.           Version 5 - Revision 5.2
  3701.  
  3702.  
  3703.       left    out  of     the TGS reply since the response to
  3704.       the TGS request is encrypted in a session key     and
  3705.       no  client  information need be retrieved from the
  3706.       KDC database.     It is up to the application  client
  3707.       (usually  the     login    program) to take appropriate
  3708.       action (such as notifying the    user) if the expira-
  3709.       tion time is imminent.
  3710.  
  3711.  
  3712. flags, authtime, starttime, endtime, renew-till    and caddr
  3713.       These    fields are duplicates of those found in     the
  3714.       encrypted portion of the attached ticket (see    sec-
  3715.       tion 5.3.1), provided    so  the     client     may  verify
  3716.       they    match  the intended request and    to assist in
  3717.       proper ticket    caching.  If the message is of    type
  3718.       KRB_TGS_REP,    the  caddr field will only be filled
  3719.       in if    the request was    for  a    proxy  or  forwarded
  3720.       ticket, or if    the user is substituting a subset of
  3721.       the addresses    from the ticket    granting ticket.  If
  3722.       the  client-requested    addresses are not present or
  3723.       not used, then  the  addresses  contained  in     the
  3724.       ticket  will    be the same as those included in the
  3725.       ticket-granting ticket.
  3726.  
  3727.  
  3728. 5.5.  Client/Server (CS) message specifications
  3729.  
  3730.      This section specifies the    format of the messages    used
  3731. for  the  authentication  of  the  client to the application
  3732. server.
  3733.  
  3734. 5.5.1.    KRB_AP_REQ definition
  3735.  
  3736.      The KRB_AP_REQ message contains the  Kerberos  protocol
  3737. version     number,  the  message    type  KRB_AP_REQ, an options
  3738. field to indicate any options in use,  and  the     ticket     and
  3739. authenticator  themselves.   The KRB_AP_REQ message is often
  3740. referred to as the "authentication header".
  3741.  
  3742. AP-REQ ::=    [APPLICATION 14] SEQUENCE {
  3743.         pvno[0]                  INTEGER,
  3744.         msg-type[1]              INTEGER,
  3745.         ap-options[2]              APOptions,
  3746.         ticket[3]              Ticket,
  3747.         authenticator[4]          EncryptedData
  3748. }
  3749.  
  3750. APOptions ::=    BIT STRING {
  3751.         reserved(0),
  3752.         use-session-key(1),
  3753.         mutual-required(2)
  3754. }
  3755.  
  3756.  
  3757.  
  3758.  
  3759. Section    5.5.1.           - 57    -    Expires 15    October    1993
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.           Version 5 - Revision 5.2
  3767.  
  3768.  
  3769. pvno and msg-type
  3770.       These    fields are described above in section 5.4.1.
  3771.       msg-type is KRB_AP_REQ.
  3772.  
  3773.  
  3774. ap-optionsThis field  appears  in  the    application  request
  3775.       (KRB_AP_REQ)    and  affects  the way the request is
  3776.       processed.  It is a bit-field, where the  selected
  3777.       options  are    indicated  by the bit being set    (1),
  3778.       and the unselected  options  and  reserved  fields
  3779.       being     reset    (0).   The  encoding  of the bits is
  3780.       specified in section 5.2.   The  meanings  of     the
  3781.       options are:
  3782.  
  3783.       Bit(s)Name           Description
  3784.  
  3785.       0    RESERVED       Reserved    for future  expansion  of  this
  3786.                    field.
  3787.  
  3788.       1    USE-SESSION-KEYThe  USE-SESSION-KEY  option   indicates
  3789.                    that the    ticket the client is presenting
  3790.                    to a server is encrypted    in the    session
  3791.                    key  from  the  server's    ticket-granting
  3792.                    ticket.    When this option is not     speci-
  3793.                    fied,  the  ticket  is  encrypted in the
  3794.                    server's    secret key.
  3795.  
  3796.       2    MUTUAL-REQUIREDThe  MUTUAL-REQUIRED  option  tells  the
  3797.                    server  that  the client    requires mutual
  3798.                    authentication, and that    it must    respond
  3799.                    with a KRB_AP_REP message.
  3800.  
  3801.       3-31    RESERVED       Reserved    for future use.
  3802.  
  3803.  
  3804.  
  3805. ticket      This field is    a ticket authenticating     the  client
  3806.       to the server.
  3807.  
  3808.  
  3809. authenticator
  3810.       This contains    the  authenticator,  which  includes
  3811.       the  client's    choice of a subkey.  Its encoding is
  3812.       described in section 5.3.2.
  3813.  
  3814. 5.5.2.    KRB_AP_REP definition
  3815.  
  3816.      The KRB_AP_REP message contains the  Kerberos  protocol
  3817. version     number,  the  message    type, and an encrypted time-
  3818. stamp.    The message is sent in in response to an application
  3819. request     (KRB_AP_REQ) where the    mutual authentication option
  3820. has been selected in the ap-options field.
  3821.  
  3822. __________________________
  3823.  
  3824.  
  3825. Section    5.5.2.           - 58    -    Expires 15    October    1993
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.           Version 5 - Revision 5.2
  3833.  
  3834.  
  3835.  
  3836. AP-REP ::=       [APPLICATION    15] SEQUENCE {
  3837.            pvno[0]                 INTEGER,
  3838.            msg-type[1]                 INTEGER,
  3839.            enc-part[2]                 EncryptedData
  3840. }
  3841.  
  3842. EncAPRepPart ::=   [APPLICATION    27[27]]    SEQUENCE {
  3843.            ctime[0]                 KerberosTime,
  3844.            cusec[1]                 INTEGER,
  3845.            subkey[2]                 EncryptionKey OPTIONAL,
  3846.            seq-number[3]             INTEGER OPTIONAL
  3847. }
  3848.  
  3849. The encoded EncAPRepPart is encrypted in the shared  session
  3850. key of the ticket.  The    optional subkey    field can be used in
  3851. an application-arranged    negotiation to choose a    per associa-
  3852. tion session key.
  3853.  
  3854.  
  3855. pvno and msg-type
  3856.       These    fields are described above in section 5.4.1.
  3857.       msg-type is KRB_AP_REP.
  3858.  
  3859.  
  3860. enc-part  This field is    described above    in section 5.4.2.
  3861.  
  3862.  
  3863. ctime      This    field  contains     the  current  time  on     the
  3864.       client's host.
  3865.  
  3866.  
  3867. cusec      This field contains the microsecond  part  of     the
  3868.       client's timestamp.
  3869.  
  3870.  
  3871. subkey      This field contains an encryption key    which is  to
  3872.       be  used to protect this specific application    ses-
  3873.       sion.     See section 3.2.6 for specifics on how    this
  3874.       field     is  used  to  negotiate  a  key.  Unless an
  3875.       application specifies    otherwise, if this field  is
  3876.       left out, the    sub-session key    from the authentica-
  3877.       tor, or if also left out, the    session    key from the
  3878.       ticket will be used.
  3879.  
  3880.  
  3881. 5.5.3.    Error message reply
  3882.  
  3883.      If    an error occurs     while    processing  the     application
  3884. __________________________
  3885. [27] An    application code in the     encrypted  part  of  a
  3886. message     provides  an additional check that the    message
  3887. was decrypted properly.
  3888.  
  3889.  
  3890.  
  3891. Section    5.5.3.           - 59    -    Expires 15    October    1993
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.           Version 5 - Revision 5.2
  3899.  
  3900.  
  3901. request, the KRB_ERROR message will  be     sent  in  response.
  3902. See  section 5.9.1 for the format of the error message.     The
  3903. cname and crealm fields    may be left out    if the server cannot
  3904. determine  their  appropriate  values from the corresponding
  3905. KRB_AP_REQ message.  If    the authenticator was  decipherable,
  3906. the ctime and cusec fields will    contain    the values from    it.
  3907.  
  3908. 5.6.  KRB_SAFE message specification
  3909.  
  3910.      This section specifies the    format of a message that can
  3911. be  used by either side    (client    or server) of an application
  3912. to send    a tamper-proof message to  its    peer.    It  presumes
  3913. that  a    session    key has    previously been    exchanged (for exam-
  3914. ple, by    using the KRB_AP_REQ/KRB_AP_REP    messages).
  3915.  
  3916. 5.6.1.    KRB_SAFE definition
  3917.  
  3918.      The KRB_SAFE message contains user    data  along  with  a
  3919. collision-proof     checksum  keyed  with the session key.     The
  3920. message    fields are:
  3921.  
  3922. KRB-SAFE ::=        [APPLICATION 20] SEQUENCE {
  3923.             pvno[0]              INTEGER,
  3924.             msg-type[1]              INTEGER,
  3925.             safe-body[2]          KRB-SAFE-BODY,
  3926.             cksum[3]              Checksum
  3927. }
  3928.  
  3929. KRB-SAFE-BODY ::=   SEQUENCE {
  3930.             user-data[0]          OCTET    STRING,
  3931.             timestamp[1]          KerberosTime OPTIONAL,
  3932.             usec[2]              INTEGER OPTIONAL,
  3933.             seq-number[3]          INTEGER OPTIONAL,
  3934.             s-address[4]          HostAddress,
  3935.             r-address[5]          HostAddress OPTIONAL
  3936. }
  3937.  
  3938.  
  3939.  
  3940.  
  3941. pvno and msg-type
  3942.       These    fields are described above in section 5.4.1.
  3943.       msg-type is KRB_SAFE.
  3944.  
  3945.  
  3946. safe-body This field is    a placeholder for the  body  of     the
  3947.       KRB-SAFE  message.  It is to be encoded separately
  3948.       and then have    the checksum computed over  it,     for
  3949.       use in the cksum field.
  3950.  
  3951.  
  3952. cksum      This field contains the checksum of  the  applica-
  3953.       tion data.  Checksum details are described in    sec-
  3954.       tion 6.4.   The  checksum  is     computed  over     the
  3955.  
  3956.  
  3957. Section    5.6.1.           - 60    -    Expires 15    October    1993
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.           Version 5 - Revision 5.2
  3965.  
  3966.  
  3967.       encoding of the KRB-SAFE-BODY    sequence.
  3968.  
  3969.  
  3970. user-data This field is    part of    the  KRB_SAFE  and  KRB_PRIV
  3971.       messages and contain the application specific    data
  3972.       that is being    passed from the    sender to the  reci-
  3973.       pient.
  3974.  
  3975.  
  3976. timestamp This field is    part of    the  KRB_SAFE  and  KRB_PRIV
  3977.       messages.   Its  contents  are the current time as
  3978.       known    by the sender of the message.    By  checking
  3979.       the  timestamp,  the    recipient  of the message is
  3980.       able to make sure that it was    recently  generated,
  3981.       and is not a replay.
  3982.  
  3983.  
  3984. usec      This field is    part of    the  KRB_SAFE  and  KRB_PRIV
  3985.       headers.   It    contains the microsecond part of the
  3986.       timestamp.
  3987.  
  3988.  
  3989. seq-number
  3990.       This field is    described above    in section 5.3.2.
  3991.  
  3992.  
  3993. s-address This field specifies the address  in    use  by     the
  3994.       sender of the    message.
  3995.  
  3996.  
  3997. r-address This field specifies the address  in    use  by     the
  3998.       recipient  of     the message.  It may be omitted for
  3999.       some uses (such as broadcast protocols),  but     the
  4000.       recipient  may  arbitrarily  reject such messages.
  4001.       This field along with    s-address  can    be  used  to
  4002.       help    detect    messages which have been incorrectly
  4003.       or maliciously delivered to the wrong    recipient.
  4004.  
  4005. 5.7.  KRB_PRIV message specification
  4006.  
  4007.      This section specifies the    format of a message that can
  4008. be  used by either side    (client    or server) of an application
  4009. to securely and    privately send a message to  its  peer.      It
  4010. presumes  that    a  session key has previously been exchanged
  4011. (for example, by using the KRB_AP_REQ/KRB_AP_REP messages).
  4012.  
  4013. 5.7.1.    KRB_PRIV definition
  4014.  
  4015.      The KRB_PRIV message contains user     data  encrypted  in
  4016. the Session Key.  The message fields are:
  4017.  
  4018. __________________________
  4019.  
  4020. [29] An    application code in the     encrypted  part  of  a
  4021. message     provides  an additional check that the    message
  4022.  
  4023. Section    5.7.1.           - 61    -    Expires 15    October    1993
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.           Version 5 - Revision 5.2
  4031.  
  4032.  
  4033.  
  4034. KRB-PRIV ::=         [APPLICATION 21] SEQUENCE {
  4035.              pvno[0]                   INTEGER,
  4036.              msg-type[1]               INTEGER,
  4037.              enc-part[3]               EncryptedData
  4038. }
  4039.  
  4040. EncKrbPrivPart ::=   [APPLICATION 28[29]] SEQUENCE {
  4041.              user-data[0]               OCTET STRING,
  4042.              timestamp[1]               KerberosTime OPTIONAL,
  4043.              usec[2]                   INTEGER OPTIONAL,
  4044.              seq-number[3]               INTEGER OPTIONAL,
  4045.              s-address[4]               HostAddress, -- sender's    addr
  4046.              r-address[5]               HostAddress OPTIONAL -- recip's addr
  4047. }
  4048.  
  4049.  
  4050.  
  4051. pvno and msg-type
  4052.       These    fields are described above in section 5.4.1.
  4053.       msg-type is KRB_PRIV.
  4054.  
  4055.  
  4056. enc-part  This field holds an encoding of the EncKrbPrivPart
  4057.       sequence  encrypted  under  the  session  key[30].
  4058.       This    encrypted  encoding is used for    the enc-part
  4059.       field    of the KRB-PRIV    message.  See section 6     for
  4060.       the format of    the ciphertext.
  4061.  
  4062.  
  4063. user-data, timestamp, usec, s-address and r-address
  4064.       These    fields are described above in section 5.6.1.
  4065.  
  4066.  
  4067. seq-number
  4068.       This field is    described above    in section 5.3.2.
  4069.  
  4070. 5.8.  KRB_CRED message specification
  4071.  
  4072.      This section specifies the    format of a message that can
  4073. be  used  to send Kerberos credentials from one    principal to
  4074. another.   It  is  presented  here  to    encourage  a  common
  4075. __________________________
  4076. was decrypted properly.
  4077.  
  4078. [30] If     supported  by the encryption method in    use, an
  4079. initialization vector may be passed to    the  encryption
  4080. procedure,  in order to    achieve    proper cipher chaining.
  4081. The initialization vector  might  come    from  the  last
  4082. block of the ciphertext    from the previous KRB_PRIV mes-
  4083. sage, but it is    the application's choice whether or not
  4084. to use such an initialization vector.  If left out, the
  4085. default    initialization vector for the encryption  algo-
  4086. rithm will be used.
  4087.  
  4088.  
  4089. Section    5.8.           - 62    -    Expires 15    October    1993
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.           Version 5 - Revision 5.2
  4097.  
  4098.  
  4099. mechanism to be    used by    applications when forwarding tickets
  4100. or  providing  proxies    to subordinate servers.     It presumes
  4101. that a session key has already    been  exchanged     perhaps  by
  4102. using the KRB_AP_REQ/KRB_AP_REP    messages.
  4103.  
  4104. 5.8.1.    KRB_CRED definition
  4105.  
  4106.      The KRB_CRED message contains a sequence of tickets  to
  4107. be sent    and information    needed to use the tickets, including
  4108. the session key    from each.  The    information  needed  to     use
  4109. the  tickets  is encryped under    an encryption key previously
  4110. exchanged.  The    message    fields are:
  4111.  
  4112. KRB-CRED     ::= [APPLICATION 22]    SEQUENCE {
  4113.          pvno[0]        INTEGER,
  4114.          msg-type[1]        INTEGER, -- KRB_CRED
  4115.          tickets[2]        SEQUENCE OF Ticket,
  4116.          enc-part[3]        EncryptedData
  4117. }
  4118.  
  4119. EncKrbCredPart     ::= [APPLICATION 29]    SEQUENCE {
  4120.          ticket-info[0]        SEQUENCE OF KrbCredInfo,
  4121.          nonce[1]        INTEGER    OPTIONAL,
  4122.          timestamp[2]        KerberosTime OPTIONAL,
  4123.          usec[3]        INTEGER    OPTIONAL,
  4124.          s-address[4]        HostAddress OPTIONAL,
  4125.          r-address[5]        HostAddress OPTIONAL
  4126. }
  4127.  
  4128. KrbCredInfo     ::=            SEQUENCE {
  4129.          key[0]            EncryptionKey,
  4130.          prealm[1]        Realm OPTIONAL,
  4131.          pname[2]        PrincipalName OPTIONAL,
  4132.          flags[3]        TicketFlags OPTIONAL,
  4133.          authtime[4]        KerberosTime OPTIONAL,
  4134.          starttime[5]        KerberosTime OPTIONAL,
  4135.          endtime[6]        KerberosTime OPTIONAL
  4136.          renew-till[7]        KerberosTime OPTIONAL,
  4137.          srealm[8]        Realm OPTIONAL,
  4138.          sname[9]        PrincipalName OPTIONAL,
  4139.          caddr[10]        HostAddresses OPTIONAL
  4140. }
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146. pvno and msg-type
  4147.       These    fields are described above in section 5.4.1.
  4148.       msg-type is KRB_CRED.
  4149.  
  4150.  
  4151. tickets
  4152.       These     are  the  tickets  obtained  from  the     KDC
  4153.  
  4154.  
  4155. Section    5.8.1.           - 63    -    Expires 15    October    1993
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.           Version 5 - Revision 5.2
  4163.  
  4164.  
  4165.       specifically    for  use  by the intended recipient.
  4166.       Successive tickets are paired    with the correspond-
  4167.       ing  KrbCredInfo sequence from the enc-part of the
  4168.       KRB-CRED message.
  4169.  
  4170.  
  4171. enc-part  This field holds an encoding of the EncKrbCredPart
  4172.       sequence  encrypted  under  the session key shared
  4173.       between the sender  and  the    intended  recipient.
  4174.       This    encrypted  encoding is used for    the enc-part
  4175.       field    of the KRB-CRED    message.  See section 6     for
  4176.       the format of    the ciphertext.
  4177.  
  4178.  
  4179. nonce      If  practical,  an  application  may    require     the
  4180.       inclusion of a nonce generated by the    recipient of
  4181.       the message.    If the same value is included as the
  4182.       nonce     in  the  message, it provides evidence    that
  4183.       the message is fresh and has not been    replayed  by
  4184.       an  attacker.      A  nonce must    never be re-used; it
  4185.       should be generated randomly by the  recipient  of
  4186.       the message and provided to the sender of the    mes-
  4187.       sage in an application specific manner.
  4188.  
  4189.  
  4190. timestamp and usec
  4191.  
  4192.       These    fields specify the time     that  the  KRB-CRED
  4193.       message  was    generated.  The    time is    used to    pro-
  4194.       vide assurance that the message is fresh.
  4195.  
  4196.  
  4197. s-address and r-address
  4198.       These    fields are described above in section 5.6.1.
  4199.       They    are  used  optionally  to provide additional
  4200.       assurance of the integrity of     the  KRB-CRED    mes-
  4201.       sage.
  4202.  
  4203.  
  4204. key      This field  exists  in  the  corresponding  ticket
  4205.       passed by the    KRB-CRED message and is    used to    pass
  4206.       the session key from the sender  to  the  intended
  4207.       recipient.   The  field's encoding is    described in
  4208.       section 6.2.
  4209.  
  4210.      The following fields are optional.      If  present,    they
  4211. can  be    associated with    the credentials    in the remote ticket
  4212. file.  If left out, then it is assumed that the    recipient of
  4213. the credentials    already    knows their value.
  4214.  
  4215.  
  4216. prealm and pname
  4217.       The name and    realm  of  the    delegated  principal
  4218.       identity.
  4219.  
  4220.  
  4221. Section    5.8.1.           - 64    -    Expires 15    October    1993
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.           Version 5 - Revision 5.2
  4229.  
  4230.  
  4231. flags, authtime,  starttime,  endtime,    renew-till,  srealm,
  4232.       sname, and caddr
  4233.       These    fields contain the values of the correspond-
  4234.       ing  fields  from  the  ticket found in the ticket
  4235.       field.  Descriptions of the fields  are  identical
  4236.       to the descriptions in the KDC-REP message.
  4237.  
  4238. 5.9.  Error message specification
  4239.  
  4240.      This section specifies the     format     for  the  KRB_ERROR
  4241. message.  The fields included in the message are intended to
  4242. return as much information as possible about an     error.      It
  4243. is  not     expected  that     all the information required by the
  4244. fields will be available for all types of  errors.   If     the
  4245. appropriate information    is not available when the message is
  4246. composed, the corresponding field will be left    out  of     the
  4247. message.
  4248.  
  4249.      Note that since the KRB_ERROR message is not  protected
  4250. by  any     encryption, it    is quite possible for an intruder to
  4251. synthesize or modify such a message.   In  particular,    this
  4252. means that the client should not use any fields    in this    mes-
  4253. sage for security-critical purposes, such as setting a    sys-
  4254. tem  clock or generating a fresh authenticator.     The message
  4255. can be useful, however,    for advising a user  on     the  reason
  4256. for some failure.
  4257.  
  4258. 5.9.1.    KRB_ERROR definition
  4259.  
  4260.      The KRB_ERROR message consists of the following fields:
  4261.  
  4262. KRB-ERROR ::=    [APPLICATION 30] SEQUENCE {
  4263.         pvno[0]                  INTEGER,
  4264.         msg-type[1]              INTEGER,
  4265.         ctime[2]              KerberosTime OPTIONAL,
  4266.         cusec[3]              INTEGER OPTIONAL,
  4267.         stime[4]              KerberosTime,
  4268.         susec[5]              INTEGER,
  4269.         error-code[6]              INTEGER,
  4270.         crealm[7]              Realm OPTIONAL,
  4271.         cname[8]              PrincipalName OPTIONAL,
  4272.         realm[9]              Realm, --    Correct    realm
  4273.         sname[10]              PrincipalName, --    Correct    name
  4274.         e-text[11]              GeneralString OPTIONAL,
  4275.         e-data[12]              OCTET STRING OPTIONAL
  4276. }
  4277.  
  4278.  
  4279.  
  4280. pvno and msg-type
  4281.       These    fields are described above in section 5.4.1.
  4282.       msg-type is KRB_ERROR.
  4283.  
  4284.  
  4285.  
  4286.  
  4287. Section    5.9.1.           - 65    -    Expires 15    October    1993
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.           Version 5 - Revision 5.2
  4295.  
  4296.  
  4297. ctime      This field is    described above    in section 5.4.1.
  4298.  
  4299.  
  4300.  
  4301. cusec      This field is    described above    in section 5.5.2.
  4302.  
  4303.  
  4304. stime      This    field  contains     the  current  time  on     the
  4305.       server.  It is of type KerberosTime.
  4306.  
  4307.  
  4308. susec      This field contains the microsecond  part  of     the
  4309.       server's  timestamp.     Its  value ranges from    0 to
  4310.       999.    It appears along with stime. The two  fields
  4311.       are  used  in     conjunction to    specify    a reasonably
  4312.       accurate timestamp.
  4313.  
  4314.  
  4315. error-codeThis field contains the  error  code    returned  by
  4316.       Kerberos  or    the server when    a request fails.  To
  4317.       interpret the    value of this field see    the list  of
  4318.       error     codes    in  section  8.     Implementations are
  4319.       encouraged to    provide    for national  language    sup-
  4320.       port in the display of error messages.
  4321.  
  4322.  
  4323. crealm,    cname, srealm and sname
  4324.       These    fields are described above in section 5.3.1.
  4325.  
  4326.  
  4327. e-text      This    field  contains     additional  text  to    help
  4328.       explain  the error code associated with the failed
  4329.       request (for example,    it might include a principal
  4330.       name which was unknown).
  4331.  
  4332.  
  4333. e-data       This    field contains    additional  data  about     the
  4334.       error     for  use  by  the  application     to  help it
  4335.       recover from or handle the error.  If     the  error-
  4336.       code    is KDC_ERR_PREAUTH_REQUIRED, then the e-data
  4337.       field    will contain an    encoding of  a    sequence  of
  4338.       padata fields, each corresponding to an acceptable
  4339.       pre-authentication method and    optionally  contain-
  4340.       ing data for the method:
  4341.  
  4342.            METHOD-DATA ::=     SEQUENCE of PA-DATA
  4343.  
  4344.  
  4345.       If the error-code is KRB_AP_ERR_METHOD,  then     the
  4346.       e-data  field    will contain an    encoding of the    fol-
  4347.       lowing sequence:
  4348.  
  4349.        METHOD-DATA ::=     SEQUENCE {
  4350.              method-type[0]      INTEGER,
  4351.  
  4352.  
  4353. Section    5.9.1.           - 66    -    Expires 15    October    1993
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.           Version 5 - Revision 5.2
  4361.  
  4362.  
  4363.              method-data[1]      OCTET    STRING OPTIONAL
  4364.        }
  4365.  
  4366.       method-type will indicate the     required  alternate
  4367.       method;  method-data    will  contain  any  required
  4368.       additional information.
  4369.  
  4370.  
  4371.  
  4372. 6.  Encryption and Checksum Specifications
  4373.  
  4374. The  Kerberos  protocols  described  in     this  document     are
  4375. designed  to  use  stream  encryption  ciphers,    which can be
  4376. simulated using    commonly available block encryption ciphers,
  4377. such  as  the  Data Encryption Standard    [11], in conjunction
  4378. with block chaining and    checksum methods  [12].      Encryption
  4379. is used    to prove the identities    of the network entities    par-
  4380. ticipating  in    message     exchanges.   The  Key    Distribution
  4381. Center     for   each  realm  is    trusted     by  all  principals
  4382. registered in that realm to store a  secret  key  in  confi-
  4383. dence.     Proof    of  knowledge  of this secret key is used to
  4384. verify the authenticity    of a principal.
  4385.  
  4386.      The KDC uses the principal's  secret  key    (in  the  AS
  4387. exchange)  or  a shared    session    key (in    the TGS    exchange) to
  4388. encrypt    responses to ticket requests; the ability to  obtain
  4389. the  secret  key or session key    implies    the knowledge of the
  4390. appropriate keys and the identity of the KDC.    The  ability
  4391. of  a  principal  to  decrypt the KDC response and present a
  4392. Ticket and a properly formed Authenticator  (generated    with
  4393. the session key    from the KDC response) to a service verifies
  4394. the identity of    the principal; likewise    the ability  of     the
  4395. service    to extract the session key from    the Ticket and prove
  4396. its knowledge thereof in a response verifies the identity of
  4397. the service.
  4398.  
  4399.      The  Kerberos  protocols  generally  assume  that     the
  4400. encryption  used  is  secure from cryptanalysis; however, in
  4401. some cases, the    order of fields    in the encrypted portions of
  4402. messages  are  arranged     to  minimize  the effects of poorly
  4403. chosen keys.  It is still important to choose good keys.  If
  4404. keys  are derived from user-typed passwords, those passwords
  4405. need to    be well    chosen to make brute force attacks more    dif-
  4406. ficult.      Poorly  chosen  keys    still  make easy targets for
  4407. intruders.
  4408.  
  4409.      The  following  sections  specify    the  encryption     and
  4410. checksum  mechanisms  currently     defined  for Kerberos.     The
  4411. encodings, chaining, and padding requirements for  each     are
  4412. described.  For    encryption methods, it is often    desirable to
  4413. place random information (often    referred to as a confounder)
  4414. at  the     start    of the message.     The requirements for a    con-
  4415. founder    are specified with each    encryption mechanism.
  4416.  
  4417.  
  4418.  
  4419. Section    6.           - 67    -    Expires 15    October    1993
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.           Version 5 - Revision 5.2
  4427.  
  4428.  
  4429.      Some encryption systems use a block-chaining method  to
  4430. improve     the the security characteristics of the ciphertext.
  4431. However, these    chaining  methods  often  don't     provide  an
  4432. integrity  check upon decryption.  Such    systems    (such as DES
  4433. in CBC mode) must be augmented with a checksum of the plain-
  4434. text  which can    be verified at decryption and used to detect
  4435. any tampering or damage.  Such checksums should    be  good  at
  4436. detecting  burst  errors  in  the  input.   If any damage is
  4437. detected, the decryption routine is expected  to  return  an
  4438. error  indicating  the    failure    of an integrity    check.    Each
  4439. encryption  type  is  expected    to  provide  and  verify  an
  4440. appropriate  checksum.    The specification of each encryption
  4441. method sets out    its checksum requirements.
  4442.  
  4443.      Finally, where a key is to    be  derived  from  a  user's
  4444. password,  an algorithm    for converting the password to a key
  4445. of the appropriate type    is included.  It  is  desirable     for
  4446. the  string  to    key function to    be one-way, and    for the    map-
  4447. ping to    be different in    different realms.  This    is important
  4448. because    users who are registered in more than one realm    will
  4449. often use the same password in each,  and  it  is  desirable
  4450. that  an  attacker  compromising  the Kerberos server in one
  4451. realm not obtain or derive the user's key in another.
  4452.  
  4453.      For an discussion of the integrity     characteristics  of
  4454. the candidate encryption and checksum methods considered for
  4455. Kerberos, the the reader is referred to    [13].
  4456.  
  4457. 6.1.  Encryption Specifications
  4458.  
  4459.      The following ASN.1 definition describes all  encrypted
  4460. messages.   The     enc-part  field  which    appears    in the unen-
  4461. crypted    part of    messages in section 5 is a sequence consist-
  4462. ing  of     an encryption type, an    optional key version number,
  4463. and the    ciphertext.
  4464.  
  4465.  
  4466. EncryptedData ::=   SEQUENCE {
  4467.             etype[0]     INTEGER, -- EncryptionType
  4468.             kvno[1]     INTEGER OPTIONAL,
  4469.             cipher[2]     OCTET STRING -- ciphertext
  4470. }
  4471.  
  4472.  
  4473. etype      This field identifies    which  encryption  algorithm
  4474.       was used to encipher the cipher.  Detailed specif-
  4475.       ications  for     selected  encryption  types  appear
  4476.       later    in this    section.
  4477.  
  4478.  
  4479. kvno      This field contains the version number of the     key
  4480.       under    which data is encrypted.  It is    only present
  4481.       in messages encrypted     under    long  lasting  keys,
  4482.       such as principals' secret keys.
  4483.  
  4484.  
  4485. Section    6.1.           - 68    -    Expires 15    October    1993
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.           Version 5 - Revision 5.2
  4493.  
  4494.  
  4495. cipher      This field contains the enciphered  text,  encoded
  4496.       as an    OCTET STRING.
  4497.  
  4498.  
  4499.      The cipher    field is generated by applying the specified
  4500. encryption  algorithm  to  data     composed of the message and
  4501. algorithm-specific inputs.   Encryption     mechanisms  defined
  4502. for  use  with    Kerberos  must    take  sufficient measures to
  4503. guarantee the integrity    of the plaintext, and  we  recommend
  4504. they  also take    measures to protect against precomputed    dic-
  4505. tionary    attacks.  If the encryption algorithm is not  itself
  4506. capable     of  doing so, the protections can often be enhanced
  4507. by adding a checksum and a confounder.
  4508.  
  4509.      The suggested format  for    the  data  to  be  encrypted
  4510. includes  a  confounder,  a checksum, the encoded plaintext,
  4511. and any    necessary padding.  The    msg-seq    field  contains     the
  4512. part of    the protocol message described in section 5 which is
  4513. to be encrypted.  The confounder, checksum, and    padding     are
  4514. all untagged and untyped, and their length is exactly suffi-
  4515. cient to hold the appropriate item.  The type and length  is
  4516. implicit  and  specified  by  the particular encryption    type
  4517. being used (etype).  The format    for the    data to    be encrypted
  4518. is described in    the following diagram:
  4519.  
  4520.       +-----------+----------+-------------+-----+
  4521.       |confounder |   check  |     msg-seq   | pad |
  4522.       +-----------+----------+-------------+-----+
  4523.  
  4524. The format cannot be described in ASN.1, but for  those     who
  4525. prefer an ASN.1-like notation:
  4526.  
  4527. CipherText ::=     ENCRYPTED     SEQUENCE {
  4528.          confounder[0]     UNTAGGED[32] OCTET STRING(conf_length)    OPTIONAL,
  4529.          check[1]     UNTAGGED OCTET    STRING(checksum_length)    OPTIONAL,
  4530.          msg-seq[2]     MsgSequence,
  4531.          pad         UNTAGGED OCTET    STRING(pad_length) OPTIONAL
  4532. }
  4533.  
  4534.  
  4535.      One generates a random confounder    of  the     appropriate
  4536. length,     placing  it in    confounder; zeroes out check; calcu-
  4537. lates the appropriate checksum over confounder,     check,     and
  4538. __________________________
  4539.  
  4540. [32] In     the  above   specification,   UNTAGGED      OCTET
  4541. STRING(length) is the notation for an octet string with
  4542. its tag    and length removed.  It    is not    a  valid  ASN.1
  4543. type.  The tag bits and    length must be removed from the
  4544. confounder since the purpose of    the  confounder     is  so
  4545. that  the  message starts with random data, but    the tag
  4546. and its    length are fixed.  For other fields, the length
  4547. and  tag  would     be redundant if they were included be-
  4548. cause they are specified by the    encryption type.
  4549.  
  4550.  
  4551. Section    6.1.           - 69    -    Expires 15    October    1993
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.           Version 5 - Revision 5.2
  4559.  
  4560.  
  4561. msg-seq, placing the result in    check;    adds  the  necessary
  4562. padding;  then    encrypts using the specified encryption    type
  4563. and the    appropriate key.
  4564.  
  4565.      Unless otherwise specified, a definition of an  encryp-
  4566. tion  algorithm     that specifies    a checksum, a length for the
  4567. confounder field, or an    octet boundary for padding uses    this
  4568. ciphertext format[33].    Those fields which are not specified
  4569. will be    omitted.
  4570.  
  4571.      In    the interest of    allowing all implementations using a
  4572. particular  encryption    type  to communicate with all others
  4573. using that type, the specification  of    an  encryption    type
  4574. defines     any  checksum that is needed as part of the encryp-
  4575. tion process.  If an alternative checksum is to    be  used,  a
  4576. new encryption type must be defined.
  4577.  
  4578.      Some  cryptosystems  require   additional     information
  4579. beyond    the  key and the data to be encrypted.    For example,
  4580. DES, when used in cipher-block-chaining     mode,    requires  an
  4581. initialization    vector.      If  required,     the description for
  4582. each encryption    type must specify the source of     such  addi-
  4583. tional information.
  4584.  
  4585. 6.2.  Encryption Keys
  4586.  
  4587.      The sequence below    shows the encoding of an  encryption
  4588. key:
  4589.  
  4590.        EncryptionKey ::=   SEQUENCE {
  4591.                keytype[0]     INTEGER,
  4592.                keyvalue[1]     OCTET STRING
  4593.        }
  4594.  
  4595.  
  4596. keytype      This field specifies the type     of  encryption     key
  4597.       that    follows     in  the  keyvalue  field.   It    will
  4598.       almost always    correspond to the  encryption  algo-
  4599.       rithm     used  to generate the EncryptedData, though
  4600.       more than one    algorithm may use the same  type  of
  4601.       key (the mapping is many to one).  This might    hap-
  4602.       pen, for example, if the encryption algorithm    uses
  4603. __________________________
  4604.  
  4605. [33] The ordering of the fields    in  the     CipherText  is
  4606. important.  Additionally, messages encoded in this for-
  4607. mat must include a length as part of the msg-seq field.
  4608. This  allows  the  recipient to    verify that the    message
  4609. has not    been truncated.     Without a length, an  attacker
  4610. could  use a chosen plaintext attack to    generate a mes-
  4611. sage which could be truncated, while leaving the check-
  4612. sum intact.  Note that if the msg-seq is an encoding of
  4613. an ASN.1 SEQUENCE or OCTET STRING, then    the  length  is
  4614. part of    that encoding.
  4615.  
  4616.  
  4617. Section    6.2.           - 70    -    Expires 15    October    1993
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.           Version 5 - Revision 5.2
  4625.  
  4626.  
  4627.       an alternate checksum    algorithm for  an  integrity
  4628.       check, or a different    chaining mechanism.
  4629.  
  4630.  
  4631. keyvalue  This field contains the key itself, encoded as  an
  4632.       octet    string.
  4633.  
  4634.      All negative values for the  encryption  key  type     are
  4635. reserved   for    local  use.   All  non-negative     values     are
  4636. reserved for officially    assigned type fields and interpreta-
  4637. tions.
  4638.  
  4639. 6.3.  Encryption Systems
  4640.  
  4641. 6.3.1.    The NULL Encryption System (null)
  4642.  
  4643.      If    no encryption is in use, the  encryption  system  is
  4644. said  to be the    NULL encryption    system.     In the    NULL encryp-
  4645. tion system there is no     checksum,  confounder    or  padding.
  4646. The  ciphertext     is  simply  the plaintext.  The NULL Key is
  4647. used by    the null encryption system and    is  zero  octets  in
  4648. length,    with keytype zero (0).
  4649.  
  4650. 6.3.2.    DES in CBC mode    with a CRC-32 checksum (des-cbc-crc)
  4651.  
  4652.      The des-cbc-crc encryption     mode  encrypts     information
  4653. under  the  Data  Encryption Standard  [11] using the cipher
  4654. block chaining mode [12].  A CRC-32 checksum  (described  in
  4655. ISO  3309  [14])  is  applied  to the confounder and message
  4656. sequence (msg-seq) and    placed    in  the     cksum    field.     DES
  4657. blocks    are  8 bytes.  As a result, the    data to    be encrypted
  4658. (the concatenation of  confounder,  checksum,  and  message)
  4659. must be    padded to an 8 byte boundary before encryption.     The
  4660. details    of the encryption of  this  data  are  identical  to
  4661. those for the des-cbc-md5 encryption mode.
  4662.  
  4663.      Note that,    since the CRC-32 checksum is not  collision-
  4664. proof,     an  attacker  could  use  a  probabilistic  chosen-
  4665. plaintext attack to generate a valid message even if a    con-
  4666. founder    is used     [13].    The use    of collision-proof checksums
  4667. is recommended for environments    where such attacks represent
  4668. a significant threat.  The use of the CRC-32 as    the checksum
  4669. for ticket or authenticator is    no  longer  mandated  as  an
  4670. interoperability requirement for Kerberos Version 5 Specifi-
  4671. cation 1 (See section 9.1 for specific details).
  4672.  
  4673.  
  4674. 6.3.3.    DES in CBC mode    with an    MD4 checksum (des-cbc-md4)
  4675.  
  4676.      The des-cbc-md4 encryption     mode  encrypts     information
  4677. under  the  Data  Encryption Standard  [11] using the cipher
  4678. block chaining mode [12].  An  MD4  checksum  (described  in
  4679. [15])  is  applied  to    the  confounder    and message sequence
  4680. (msg-seq) and placed in    the cksum field.  DES blocks  are  8
  4681.  
  4682.  
  4683. Section    6.3.3.           - 71    -    Expires 15    October    1993
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.           Version 5 - Revision 5.2
  4691.  
  4692.  
  4693. bytes.     As a result, the data to be encrypted (the concate-
  4694. nation of confounder, checksum,    and message) must be  padded
  4695. to an 8    byte boundary before encryption.  The details of the
  4696. encryption of this data    are identical to those for the    des-
  4697. cbc-md5    encryption mode.
  4698.  
  4699.  
  4700. 6.3.4.    DES in CBC mode    with an    MD5 checksum (des-cbc-md5)
  4701.  
  4702.      The des-cbc-md5 encryption     mode  encrypts     information
  4703. under  the  Data  Encryption Standard  [11] using the cipher
  4704. block chaining mode [12].  An MD5  checksum   (described  in
  4705. [16].)    is  applied  to     the confounder    and message sequence
  4706. (msg-seq) and placed in    the cksum field.  DES blocks  are  8
  4707. bytes.     As a result, the data to be encrypted (the concate-
  4708. nation of confounder, checksum,    and message) must be  padded
  4709. to an 8    byte boundary before encryption.
  4710.  
  4711.      Plaintext and DES ciphtertext are    encoded     as  8-octet
  4712. blocks    which are concatenated to make the 64-bit inputs for
  4713. the DES    algorithms.  The first octet  supplies    the  8    most
  4714. significant  bits  (with  the  octet's MSbit used as the DES
  4715. input block's MSbit, etc.), the     second     octet    the  next  8
  4716. bits,  ..., and    the eighth octet supplies the 8    least signi-
  4717. ficant bits.
  4718.  
  4719.      Encryption     under    DES  using  cipher  block   chaining
  4720. requires  an  additional input in the form of an initializa-
  4721. tion vector.  Unless otherwise    specified,  zero  should  be
  4722. used  as  the  initialization  vector.    Kerberos' use of DES
  4723. requires an 8-octet confounder.
  4724.  
  4725.      The DES specifications identify some "weak" and  "semi-
  4726. weak" keys; those keys shall not be used for encrypting    mes-
  4727. sages for use in Kerberos.  Additionally, because of the way
  4728. that  keys are derived for the encryption of checksums,    keys
  4729. shall not be used that yield "weak" or "semi-weak" keys    when
  4730. eXclusive-ORed with the    constant F0F0F0F0F0F0F0F0.
  4731.  
  4732.      A DES key is 8 octets of data, with  keytype  one    (1).
  4733. This  consists of 56 bits of key, and 8    parity bits (one per
  4734. octet).     The key is encoded as a series    of 8 octets  written
  4735. in  MSB-first  order.    The  bits  within  the    key are    also
  4736. encoded    in MSB order.  For example, if the encryption key is
  4737. (B1,B2,...,B7,P1,B8,...,B14,P2,B15,...,B49,P7,B50,...,B56,P8)
  4738. where B1,B2,...,B56 are    the  key  bits    in  MSB     order,     and
  4739. P1,P2,...,P8 are the parity bits, the first octet of the key
  4740. would be B1,B2,...,B7,P1 (with B1 as the MSbit).   [See     the
  4741. FIPS 81    introduction for reference.]
  4742.  
  4743.      To    generate a DES key from    a  text     string     (password),
  4744. the  text  string normally must    have the realm and each    com-
  4745. ponent of the principal's  name     appended[34],    then  padded
  4746. __________________________
  4747.  
  4748.  
  4749. Section    6.3.4.           - 72    -    Expires 15    October    1993
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.           Version 5 - Revision 5.2
  4757.  
  4758.  
  4759. with ASCII nulls to an 8 byte boundary.     This string is    then
  4760. fan-folded  and    eXclusive-ORed with itself to form an 8    byte
  4761. DES key.  The parity is    corrected on the key, and it is    used
  4762. to  generate  a    DES CBC    checksum on the    initial    string (with
  4763. the realm and name appended).  Next, parity is corrected  on
  4764. the  CBC checksum.  If the result matches a "weak" or "semi-
  4765. weak" key as described    in  the     DES  specification,  it  is
  4766. eXclusive-ORed with the    constant 00000000000000F0.  Finally,
  4767. the result is returned as the key.  Pseudocode follows:
  4768.  
  4769.      string_to_key(string,realm,name) {
  4770.       odd =    1;
  4771.       s = string + realm;
  4772.       for(each component in    name) {
  4773.            s = s + component;
  4774.       }
  4775.       tempkey = NULL;
  4776.       pad(s); /* with nulls    to 8 byte boundary */
  4777.       for(8byteblock in s) {
  4778.            if(odd == 0)  {
  4779.            odd = 1;
  4780.            reverse(8byteblock)
  4781.            }
  4782.            else odd    = 0;
  4783.            tempkey = tempkey XOR 8byteblock;
  4784.       }
  4785.       fixparity(tempkey);
  4786.       key =    DES-CBC-check(s,tempkey);
  4787.       fixparity(key);
  4788.       if(is_weak_key_key(key))
  4789.            key = key XOR 0xF0;
  4790.       return(key);
  4791.      }
  4792.  
  4793. 6.4.  Checksums
  4794.  
  4795.      The following is the ASN.1    definition used    for a check-
  4796. sum:
  4797.  
  4798.      Checksum ::=    SEQUENCE {
  4799.             cksumtype[0]   INTEGER,
  4800.             checksum[1]    OCTET STRING
  4801.      }
  4802.  
  4803.  
  4804. cksumtype This field indicates the algorithm  used  to    gen-
  4805.       erate    the accompanying checksum.
  4806.  
  4807. checksum  This field contains the checksum  itself,  encoded
  4808. __________________________
  4809. [34] In    some cases, it may be necessary    to use    a  dif-
  4810. ferent    "mix-in"  string for compatibility reasons; see
  4811. the discussion of padata in section 5.4.2.
  4812.  
  4813.  
  4814.  
  4815. Section    6.4.           - 73    -    Expires 15    October    1993
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.           Version 5 - Revision 5.2
  4823.  
  4824.  
  4825.       as an    octet string.
  4826.  
  4827.      Detailed  specification  of  selected  checksum   types
  4828. appear    later  in  this     section.   Negative  values for the
  4829. checksum type are reserved for local use.  All    non-negative
  4830. values    are reserved for officially assigned type fields and
  4831. interpretations.
  4832.  
  4833.      Checksums used by Kerberos    can  be     classified  by     two
  4834. properties:   whether  they are    collision-proof, and whether
  4835. they are keyed.     It is infeasible  to  find  two  plaintexts
  4836. which generate the same    checksum value for a collision-proof
  4837. checksum.  A key is required to    perturb     or  initialize     the
  4838. algorithm  in  a  keyed    checksum.  To prevent message-stream
  4839. modification by    an active attacker, unkeyed checksums should
  4840. only  be  used    when the checksum and message will be subse-
  4841. quently    encrypted (e.g.    the checksums defined as part of the
  4842. encryption  algorithms    covered     earlier  in  this section).
  4843. Collision-proof    checksums can be made tamper-proof  as    well
  4844. if  the     checksum  value  is encrypted before inclusion    in a
  4845. message.  In such cases, the composition of the    checksum and
  4846. the  encryption     algorithm  must  be  considered  a separate
  4847. checksum algorithm (e.g. RSA-MD5 encrypted using  DES  is  a
  4848. new checksum algorithm of type RSA-MD5-DES).  For most keyed
  4849. checksums, as well as for the encrypted    forms of  collision-
  4850. proof  checksums,  Kerberos prepends a confounder before the
  4851. checksum is calculated.
  4852.  
  4853. 6.4.1.    The CRC-32 Checksum (crc32)
  4854.  
  4855.      The CRC-32    checksum calculates a checksum    based  on  a
  4856. cyclic    redundancy check as described in ISO 3309 [14].     The
  4857. resulting checksum is four (4) octets in length.  The CRC-32
  4858. is  neither  keyed  nor     collision-proof.   The     use of    this
  4859. checksum is not    recommended.  An  attacker  using  a  proba-
  4860. bilistic  chosen-plaintext attack as described in [13] might
  4861. be able    to generate an alternative  message  that  satisfies
  4862. the  checksum.     The  use  of  collision-proof    checksums is
  4863. recommended for    environments where such    attacks    represent  a
  4864. significant threat.
  4865.  
  4866. 6.4.2.    The RSA    MD4 Checksum (rsa-md4)
  4867.  
  4868.      The RSA-MD4 checksum calculates a    checksum  using     the
  4869. RSA  MD4  algorithm  [15].   The algorithm takes as input an
  4870. input message of arbitrary length and produces as  output  a
  4871. 128-bit     (16  octet)  checksum.      RSA-MD4  is believed to be
  4872. collision-proof.
  4873.  
  4874. 6.4.3.    RSA MD4    Cryptographic Checksum Using  DES  (rsa-md4-
  4875. des)
  4876.  
  4877.      The RSA-MD4-DES checksum calculates a keyed  collision-
  4878. proof  checksum     by  prepending    an 8 octet confounder before
  4879.  
  4880.  
  4881. Section    6.4.3.           - 74    -    Expires 15    October    1993
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.           Version 5 - Revision 5.2
  4889.  
  4890.  
  4891. the text, applying  the     RSA  MD4  checksum  algorithm,     and
  4892. encrypting  the     confounder  and  the  checksum    using DES in
  4893. cipher-block-chaining (CBC) mode using a variant of the    key,
  4894. where  the  variant  is     computed by eXclusive-ORing the key
  4895. with the constant F0F0F0F0F0F0F0F0[35].     The  initialization
  4896. vector    should be zero.     The resulting checksum    is 24 octets
  4897. long (8    octets of which    are redundant).      This    checksum  is
  4898. tamper-proof and believed to be    collision-proof.
  4899.  
  4900.      The DES specifications identify some "weak    keys"; those
  4901. keys  shall not    be used    for generating RSA-MD4 checksums for
  4902. use in Kerberos.
  4903.  
  4904.      The format    for the    checksum is described in the follow-
  4905. ing diagram:
  4906.  
  4907. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4908. |  des-cbc(confounder    +   rsa-md4(confounder+msg),key=var(key),iv=0)    |
  4909. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4910.  
  4911. The format cannot be described in ASN.1, but for  those     who
  4912. prefer an ASN.1-like notation:
  4913.  
  4914. rsa-md4-des-checksum ::=   ENCRYPTED       UNTAGGED SEQUENCE {
  4915.                confounder[0]   UNTAGGED OCTET STRING(8),
  4916.                check[1]       UNTAGGED OCTET STRING(16)
  4917. }
  4918.  
  4919.  
  4920.  
  4921. 6.4.4.    The RSA    MD5 Checksum (rsa-md5)
  4922.  
  4923.      The RSA-MD5 checksum calculates a    checksum  using     the
  4924. RSA  MD5  algorithm  [16]..  The algorithm takes as input an
  4925. input message of arbitrary length and produces as  output  a
  4926. 128-bit     (16  octet)  checksum.      RSA-MD5  is believed to be
  4927. collision-proof.
  4928.  
  4929. 6.4.5.    RSA MD5    Cryptographic Checksum Using  DES  (rsa-md5-
  4930. des)
  4931.  
  4932.      The RSA-MD5-DES checksum calculates a keyed  collision-
  4933. proof  checksum     by  prepending    an 8 octet confounder before
  4934. __________________________
  4935.  
  4936. [35] A variant of the key is used to limit the use of a
  4937. key  to    a particular function, separating the functions
  4938. of generating a    checksum  from    other  encryption  per-
  4939. formed     using     the   session     key.     The   constant
  4940. F0F0F0F0F0F0F0F0 was chosen because  it     maintains  key
  4941. parity.     The properties    of DES precluded the use of the
  4942. complement.  The same constant is used for similar pur-
  4943. pose  in  the  Message    Integrity  Check in the    Privacy
  4944. Enhanced Mail standard.
  4945.  
  4946.  
  4947. Section    6.4.5.           - 75    -    Expires 15    October    1993
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.           Version 5 - Revision 5.2
  4955.  
  4956.  
  4957. the text, applying  the     RSA  MD5  checksum  algorithm,     and
  4958. encrypting  the     confounder  and  the  checksum    using DES in
  4959. cipher-block-chaining (CBC) mode using a variant of the    key,
  4960. where  the  variant  is     computed by eXclusive-ORing the key
  4961. with the constant F0F0F0F0F0F0F0F0.  The initialization    vec-
  4962. tor  should  be     zero.     The resulting checksum    is 24 octets
  4963. long (8    octets of which    are redundant).      This    checksum  is
  4964. tamper-proof and believed to be    collision-proof.
  4965.  
  4966.      The DES specifications identify some "weak    keys"; those
  4967. keys  shall not    be used    for encrypting RSA-MD5 checksums for
  4968. use in Kerberos.
  4969.  
  4970.      The format    for the    checksum is described in the follow-
  4971. ing diagram:
  4972.  
  4973. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4974. |  des-cbc(confounder    +   rsa-md5(confounder+msg),key=var(key),iv=0)    |
  4975. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4976.  
  4977. The format cannot be described in ASN.1, but for  those     who
  4978. prefer an ASN.1-like notation:
  4979.  
  4980. rsa-md5-des-checksum ::=   ENCRYPTED       UNTAGGED SEQUENCE {
  4981.                confounder[0]   UNTAGGED OCTET STRING(8),
  4982.                check[1]       UNTAGGED OCTET STRING(16)
  4983. }
  4984.  
  4985.  
  4986. 6.4.6.    DES cipher-block chained checksum (des-mac)
  4987.  
  4988.      The DES-MAC checksum is computed  by  prepending  an  8
  4989. octet confounder to the    plaintext, performing a    DES CBC-mode
  4990. encryption on the result using the key and an initialization
  4991. vector    of  zero,  taking  the last block of the ciphertext,
  4992. prepending the same confounder and encrypting the pair using
  4993. DES in cipher-block-chaining (CBC) mode    using a    a variant of
  4994. the key, where the variant is  computed     by  eXclusive-ORing
  4995. the key    with the constant F0F0F0F0F0F0F0F0.  The initializa-
  4996. tion vector should be zero.  The resulting checksum  is     128
  4997. bits (16 octets) long, 64 bits of which    are redundant.    This
  4998. checksum is tamper-proof and collision-proof.
  4999.  
  5000.      The format    for the    checksum is described in the follow-
  5001. ing diagram:
  5002.  
  5003. +--+--+--+--+--+--+--+--+-----+-----+-----+-----+-----+-----+-----+-----+
  5004. |   des-cbc(confounder    + des-mac(conf+msg,iv=0,key),key=var(key),iv=0)    |
  5005. +--+--+--+--+--+--+--+--+-----+-----+-----+-----+-----+-----+-----+-----+
  5006.  
  5007. The format cannot be described in ASN.1, but for  those     who
  5008. prefer an ASN.1-like notation:
  5009.  
  5010.  
  5011.  
  5012.  
  5013. Section    6.4.6.           - 76    -    Expires 15    October    1993
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.           Version 5 - Revision 5.2
  5021.  
  5022.  
  5023.  
  5024. des-mac-checksum ::=   ENCRYPTED       UNTAGGED    SEQUENCE {
  5025.                confounder[0]   UNTAGGED    OCTET STRING(8),
  5026.                check[1]           UNTAGGED    OCTET STRING(8)
  5027. }
  5028.  
  5029.  
  5030.      The DES specifications identify some "weak" and  "semi-
  5031. weak"  keys;  those  keys  shall  not be used for generating
  5032. DES-MAC    checksums for use in Kerberos, nor shall  a  key  be
  5033. used whose veriant is "weak" or    "semi-weak".
  5034.  
  5035. 6.4.7.    RSA MD4    Cryptographic Checksum Using DES alternative
  5036. (rsa-md4-des-k)
  5037.  
  5038.      The   RSA-MD4-DES-K   checksum   calculates   a   keyed
  5039. collision-proof     checksum  by  applying    the RSA    MD4 checksum
  5040. algorithm and encrypting the results using  DES     in  cipher-
  5041. block-chaining    (CBC)  mode  using a DES key as    both key and
  5042. initialization vector.    The resulting checksum is 16  octets
  5043. long.    This  checksum    is  tamper-proof  and believed to be
  5044. collision-proof.  Note that this checksum type    is  the     old
  5045. method    for  encoding  the RSA-MD4-DES checksum    and it is no
  5046. longer recommended.
  5047.  
  5048. 6.4.8.    DES cipher-block chained checksum alternative  (des-
  5049. mac-k)
  5050.  
  5051.      The DES-MAC-K checksum is computed    by performing a     DES
  5052. CBC-mode  encryption  of  the  plaintext, and using the    last
  5053. block of the ciphertext    as the checksum    value.    It is  keyed
  5054. with  an  encryption  key  and an initialization vector; any
  5055. uses which do not specify an additional    initialization    vec-
  5056. tor  will use the key as both key and initialization vector.
  5057. The resulting checksum is 64 bits  (8  octets)    long.    This
  5058. checksum  is  tamper-proof  and     collision-proof.  Note    that
  5059. this checksum type is the old method for encoding  the    DES-
  5060. MAC checksum and it is no longer recommended.
  5061.  
  5062.      The DES specifications identify some "weak    keys"; those
  5063. keys  shall not    be used    for generating DES-MAC checksums for
  5064. use in Kerberos.
  5065.  
  5066. 7.  Naming Constraints
  5067.  
  5068.  
  5069. 7.1.  Realm Names
  5070.  
  5071.      Although realm names are encoded as GeneralStrings     and
  5072. although a realm can technically select    any name it chooses,
  5073. interoperability across    realm boundaries requires  agreement
  5074. on  how    realm names are    to be assigned,    and what information
  5075. they imply.
  5076.  
  5077.  
  5078.  
  5079. Section    7.1.           - 77    -    Expires 15    October    1993
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.           Version 5 - Revision 5.2
  5087.  
  5088.  
  5089.      To    enforce    these conventions, each    realm  must  conform
  5090. to  the     conventions  itself,  and  it must require that any
  5091. realms with which inter-realm keys are shared  also  conform
  5092. to the conventions and require the same    from its neighbors.
  5093.  
  5094.      There are presently four styles of    realm names: domain,
  5095. X500, other, and reserved.  Examples of    each style follow:
  5096.  
  5097.      domain:   host.subdomain.domain (example)
  5098.        X500:   C=US/O=OSF (example)
  5099.       other:   NAMETYPE:rest/of.name=without-restrictions (example)
  5100.    reserved:   reserved, but will not conflict with above
  5101.  
  5102.  
  5103. Domain names must look like domain names:  they     consist  of
  5104. components separated by    periods    (.) and    they contain neither
  5105. colons (:) nor slashes (/).
  5106.  
  5107.      X.500 names contain an equal (=) and cannot  contain  a
  5108. colon (:) before the equal.  The realm names for X.500 names
  5109. will be    string representations of the names with  components
  5110. separated by slashes.  Leading and trailing slashes will not
  5111. be included.
  5112.  
  5113.      Names that    fall into the other category must begin    with
  5114. a  prefix  that     contains no equal (=) or period (.) and the
  5115. prefix must be followed    by a colon (:) and the rest  of     the
  5116. name.    All  prefixes  must  be     assigned before they may be
  5117. used.  Presently none are assigned.
  5118.  
  5119.      The reserved category includes  strings  which  do     not
  5120. fall  into  the     first    three categories.  All names in    this
  5121. category are reserved.    It is unlikely that  names  will  be
  5122. assigned  to  this  category  unless  there is a very strong
  5123. argument for not using the "other" category.
  5124.  
  5125.      These rules guarantee that    there will be  no  conflicts
  5126. between     the  various name styles.  The    following additional
  5127. constraints apply to the assignment of realm  names  in     the
  5128. domain    and  X.500  categories:     the name of a realm for the
  5129. domain or X.500    formats    must either be used by the organiza-
  5130. tion  owning  (to  whom     it was    assigned) an Internet domain
  5131. name or    X.500 name, or in the case that    no  such  names     are
  5132. registered,  authority    to  use     a realm name may be derived
  5133. from the authority of the  parent  realm.  For    example,  if
  5134. there  is  no domain name for E40.MIT.EDU, then    the adminis-
  5135. trator of the MIT.EDU realm can    authorize the creation of  a
  5136. realm with that    name.
  5137.  
  5138.      This is acceptable    because    the  organization  to  which
  5139. the  parent  is     assigned  is  presumably  the    organization
  5140. authorized to assign names to its children in the X.500     and
  5141. domain    name systems as    well.  If the parent assigns a realm
  5142. name without also registering it in the    domain name or X.500
  5143.  
  5144.  
  5145. Section    7.1.           - 78    -    Expires 15    October    1993
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.           Version 5 - Revision 5.2
  5153.  
  5154.  
  5155. hierarchy,  it    is  the    parent's responsibility    to make    sure
  5156. that there will    not in the future exists a name    identical to
  5157. the  realm  name  of  the child    unless it is assigned to the
  5158. same entity as the realm name.
  5159.  
  5160.  
  5161. 7.2.  Principal    Names
  5162.  
  5163.      As    was the    case for realm names, conventions are needed
  5164. to ensure that all agree on what information is    implied    by a
  5165. principal name.     The name-type field that  is  part  of     the
  5166. principal  name    indicates the kind of information implied by
  5167. the name.  The    name-type  should  be  treated    as  a  hint.
  5168. Ignoring  the  name type, no two names can be the same (i.e.
  5169. at least one of    the components,    or the realm, must  be    dif-
  5170. ferent).   This     constraint may    be eliminated in the future.
  5171. The following name types are defined:
  5172.  
  5173.    name-type      value      meaning
  5174.    NT-UNKNOWN        0      Name type not    known
  5175.    NT-PRINCIPAL        1      Just the name    of the principal as in DCE, or for users
  5176.    NT-SRV-INST        2      Service and other unique instance (krbtgt)
  5177.    NT-SRV-HST        3      Service with host name as instance (telnet, rcommands)
  5178.    NT-SRV-XHST        4      Service with host as remaining components
  5179.    NT-UID        5      Unique ID
  5180.  
  5181.  
  5182. When a name implies no information other than its uniqueness
  5183. at a particular    time the name type PRINCIPAL should be used.
  5184. The principal name type    should be used    for  users,  and  it
  5185. might  also  be     used for a unique server.  If the name    is a
  5186. unique machine generated ID that is guaranteed never  to  be
  5187. reassigned  then  the  name type of UID    should be used (note
  5188. that it    is generally a bad idea    to  reassign  names  of     any
  5189. type  since  stale  entries  might  remain in access control
  5190. lists).
  5191.  
  5192.      If    the first component of a name identifies  a  service
  5193. and  the  remaining  components     identify an instance of the
  5194. service    in a server specified manner, then the name type  of
  5195. SRV-INST  should  be  used.  An    example    of this    name type is
  5196. the Kerberos ticket-granting ticket which has a     first    com-
  5197. ponent    of  krbtgt  and     a  second component identifying the
  5198. realm for which    the ticket is valid.
  5199.  
  5200.      If    instance is a single component following the service
  5201. name  and  the    instance  identifies  the  host    on which the
  5202. server is running, then    the  name  type     SRV-HST  should  be
  5203. used.    This  type  is    typically used for Internet services
  5204. such as    telnet and the Berkeley    R commands.  If    the separate
  5205. components  of the host    name appear as successive components
  5206. following the name of the service, then    the name  type    SRV-
  5207. XHST  should  be  used.     This type might be used to identify
  5208. servers    on hosts with X.500 names where    the slash (/)  might
  5209.  
  5210.  
  5211. Section    7.2.           - 79    -    Expires 15    October    1993
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.           Version 5 - Revision 5.2
  5219.  
  5220.  
  5221. otherwise be ambiguous.
  5222.  
  5223.      A name type of UNKNOWN should be used when    the form  of
  5224. the name is not    known.    When comparing names, a    name of    type
  5225. UNKNOWN    will match principals authenticated  with  names  of
  5226. any  type.   A    principal  authenticated with a    name of    type
  5227. UNKNOWN, however, will only match other    names of  type    UNK-
  5228. NOWN.
  5229.  
  5230.      Names of any type with an initial component of "krbtgt"
  5231. are  reserved for the Kerberos ticket granting service.     See
  5232. section    8.2.3 for the form of such names.
  5233.  
  5234. 7.2.1.    Name of    server principals
  5235.  
  5236.      The principal identifier for a server on  a  host    will
  5237. generally be composed of two parts: (1)    the realm of the KDC
  5238. with which the server is registered, and (2) a two-component
  5239. name  of  type    NT-SRV-HST  if    the host name is an Internet
  5240. domain name or a multi-component name of type NT-SRV-XHST if
  5241. the  name of the host is of a form such    as X.500 that allows
  5242. slash (/) separators.  The first component of  the  two-  or
  5243. multi-component     name  will  identify  the  service  and the
  5244. latter components will identify    the host.  Where the name of
  5245. the  host  is not case sensitive (for example, with Internet
  5246. domain names) the name of the host must    be lower case.     For
  5247. services  such    as  telnet and the Berkeley R commands which
  5248. run with system    privileges, the    first component    will be     the
  5249. string "host" instead of a service specific identifier.
  5250.  
  5251. 8.  Constants and other    defined    values
  5252.  
  5253.  
  5254. 8.1.  Host address types
  5255.  
  5256.      All negative values  for  the  host  address  type     are
  5257. reserved   for    local  use.   All  non-negative     values     are
  5258. reserved for officially    assigned type fields and interpreta-
  5259. tions.
  5260.  
  5261.      The values    of the types for the following addresses are
  5262. chosen    to match the defined address family constants in the
  5263. Berkeley Standard Distributions    of Unix.  They can be  found
  5264. in  <sys/socket.h>  with symbolic names    AF_xxx (where xxx is
  5265. an abbreviation    of the address family name).
  5266.  
  5267.  
  5268. Internet addresses
  5269.  
  5270.      Internet addresses     are  32-bit  (4-octet)     quantities,
  5271. encoded    in MSB order.  The type    of internet addresses is two
  5272. (2).
  5273.  
  5274.  
  5275.  
  5276.  
  5277. Section    8.1.           - 80    -    Expires 15    October    1993
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.           Version 5 - Revision 5.2
  5285.  
  5286.  
  5287. CHAOSnet addresses
  5288.  
  5289.      CHAOSnet addresses     are  16-bit  (2-octet)     quantities,
  5290. encoded     in  MSB  order.   The type of CHAOSnet    addresses is
  5291. five (5).
  5292.  
  5293. ISO addresses
  5294.  
  5295.      ISO addresses are variable-length.      The  type  of     ISO
  5296. addresses is seven (7).
  5297.  
  5298. Xerox Network Services (XNS) addresses
  5299.  
  5300.      XNS addresses are 48-bit (6-octet)    quantities,  encoded
  5301. in MSB order.  The type    of XNS addresses is six    (6).
  5302.  
  5303. AppleTalk Datagram Delivery Protocol (DDP) addresses
  5304.  
  5305.      AppleTalk DDP addresses consist of    an 8-bit node number
  5306. and a 16-bit network number.  The first    octet of the address
  5307. is the node number; the    remaining two octets encode the    net-
  5308. work  number  in  MSB  order.    The  type  of  AppleTalk DDP
  5309. addresses is sixteen (16).
  5310.  
  5311. DECnet Phase IV    addresses
  5312.  
  5313.      DECnet Phase IV addresses are 16-bit addresses, encoded
  5314. in  LSB     order.      The  type  of    DECnet Phase IV    addresses is
  5315. twelve (12).
  5316.  
  5317. 8.2.  KDC messages
  5318.  
  5319. 8.2.1.    IP transport
  5320.  
  5321.      When  contacting  a  Kerberos  server   (KDC)   for   a
  5322. KRB_KDC_REQ  request  using  IP     transport, the    client shall
  5323. send a UDP datagram  containing     only  an  encoding  of     the
  5324. request     to  port  88 (decimal)    at the KDC's IP    address; the
  5325. KDC will respond with a    reply datagram    containing  only  an
  5326. encoding  of  the  reply  message  (either  a KRB_ERROR    or a
  5327. KRB_KDC_REP) to    the sending port at the    sender's IP address.
  5328.  
  5329. 8.2.2.    OSI transport
  5330.  
  5331.      During authentication of  an  OSI    client    to  and     OSI
  5332. server,    the mutual authentication of an    OSI server to an OSI
  5333. client,    the transfer of    credentials from an OSI    client to an
  5334. OSI  server,  or  during  exchange  of    private    or integrity
  5335. checked    messages, Kerberos protocol messages may be  treated
  5336. as opaque objects and the type of the authentication mechan-
  5337. ism will be:
  5338.  
  5339. OBJECT IDENTIFIER ::= {iso (1),    org(3),    dod(5),internet(1), security(5), kerberosv5(2)}
  5340.  
  5341.  
  5342.  
  5343. Section    8.2.2.           - 81    -    Expires 15    October    1993
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.           Version 5 - Revision 5.2
  5351.  
  5352.  
  5353. Depending on the situation, the    opaque    object    will  be  an
  5354. authentication    header (KRB_AP_REQ), an    authentication reply
  5355. (KRB_AP_REP), a    safe message (KRB_SAFE), a  private  message
  5356. (KRB_PRIV), or a credentials message (KRB_CRED).  The opaque
  5357. data contains an application code as specified in the  ASN.1
  5358. description  for  each message.     The application code may be
  5359. used by    Kerberos to determine the message type.
  5360.  
  5361. 8.2.3.    Name of    the TGS
  5362.  
  5363.      The principal identifier of the ticket-granting service
  5364. shall  be  composed of three parts: (1)    the realm of the KDC
  5365. issuing    the TGS    ticket (2) a two-part name of  type  NT-SRV-
  5366. INST,  with  the first part "krbtgt" and the second part the
  5367. name of    the realm  which  will    accept    the  ticket-granting
  5368. ticket.     For example, a    ticket-granting    ticket issued by the
  5369. ATHENA.MIT.EDU realm to    be used     to  get  tickets  from     the
  5370. ATHENA.MIT.EDU     KDC   has   a     principal   identifier      of
  5371. "ATHENA.MIT.EDU"   (realm),   ("krbtgt",   "ATHENA.MIT.EDU")
  5372. (name).        A    ticket-granting      ticket   issued   by     the
  5373. ATHENA.MIT.EDU realm to    be used     to  get  tickets  from     the
  5374. MIT.EDU    realm has a principal identifier of "ATHENA.MIT.EDU"
  5375. (realm), ("krbtgt", "MIT.EDU") (name).
  5376.  
  5377. 8.3.  Protocol constants and associated    values
  5378.  
  5379.      The following tables list constants used in the  proto-
  5380. col and    defines    their meanings.
  5381.  
  5382. Encryption type            etype value        block size        minimum pad    size   confounder size
  5383. NULL                0            1            0               0
  5384. des-cbc-crc            1            8            4               8
  5385. des-cbc-md4            2            8            0               8
  5386. des-cbc-md5            3            8            0               8
  5387.  
  5388. Checksum type            sumtype    value        checksum size
  5389. CRC32                1            4
  5390. rsa-md4                2            16
  5391. rsa-md4-des            3            24
  5392. des-mac                4            16
  5393. des-mac-k            5            8
  5394. rsa-md4-des-k            6            16
  5395. rsa-md5                7            16
  5396. rsa-md5-des            8            24
  5397.  
  5398. padata type            padata-type value
  5399. PA-TGS-REQ            1
  5400. PA-ENC-TIMESTAMP        2
  5401. PA-PW-SALT            3
  5402.  
  5403. authorization data type        ad-type    value
  5404. reserved values            0-63
  5405. OSF-DCE                64
  5406. SESAME                65
  5407.  
  5408.  
  5409. Section    8.3.           - 82    -    Expires 15    October    1993
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.           Version 5 - Revision 5.2
  5417.  
  5418.  
  5419. alternate authentication type    method-type value
  5420. reserved values            0-63
  5421. ATT-CHALLENGE-RESPONSE        64
  5422.  
  5423. transited encoding type        tr-type    value
  5424. DOMAIN-X500-COMPRESS        1
  5425. reserved values            all others
  5426.  
  5427.  
  5428. Label                   Value   Meaning or MIT code
  5429.  
  5430. pvno                   5   current Kerberos    protocol version number
  5431.  
  5432. message    types
  5433.  
  5434. KRB_AS_REQ              10   Request for initial authentication
  5435. KRB_AS_REP              11   Response    to KRB_AS_REQ request
  5436. KRB_TGS_REQ              12   Request for authentication based    on TGT
  5437. KRB_TGS_REP              13   Response    to KRB_TGS_REQ request
  5438. KRB_AP_REQ              14   application request to server
  5439. KRB_AP_REP              15   Response    to KRB_AP_REQ_MUTUAL
  5440. KRB_SAFE              20   Safe (checksummed) application message
  5441. KRB_PRIV              21   Private (encrypted) application message
  5442. KRB_CRED              22   Private (encrypted) message to forward credentials
  5443. KRB_ERROR              30   Error response
  5444.  
  5445. name types
  5446.  
  5447. KRB_NT_UNKNOWN               0   Name type not known
  5448. KRB_NT_PRINCIPAL           1   Just the    name of    the principal as in DCE, or for    users
  5449. KRB_NT_SRV_INST               2   Service and other unique    instance (krbtgt)
  5450. KRB_NT_SRV_HST               3   Service with host name as instance (telnet, rcommands)
  5451. KRB_NT_SRV_XHST               4   Service with host as remaining components
  5452. KRB_NT_UID               5   Unique ID
  5453.  
  5454. error codes
  5455.  
  5456. KDC_ERR_NONE               0   No error
  5457. KDC_ERR_NAME_EXP           1   Client's    entry in database has expired
  5458. KDC_ERR_SERVICE_EXP           2   Server's    entry in database has expired
  5459. KDC_ERR_BAD_PVNO           3   Requested protocol version number not supported
  5460. KDC_ERR_C_OLD_MAST_KVNO           4   Client's    key encrypted in old master key
  5461. KDC_ERR_S_OLD_MAST_KVNO           5   Server's    key encrypted in old master key
  5462. KDC_ERR_C_PRINCIPAL_UNKNOWN       6   Client not found    in Kerberos database
  5463. KDC_ERR_S_PRINCIPAL_UNKNOWN       7   Server not found    in Kerberos database
  5464. KDC_ERR_PRINCIPAL_NOT_UNIQUE       8   Multiple    principal entries in database
  5465. KDC_ERR_NULL_KEY           9   The client or server has    a null key
  5466. KDC_ERR_CANNOT_POSTDATE          10   Ticket not eligible for postdating
  5467. KDC_ERR_NEVER_VALID          11   Requested start time is later than end time
  5468. KDC_ERR_POLICY              12   KDC policy rejects request
  5469. KDC_ERR_BADOPTION          13   KDC cannot accommodate requested    option
  5470. KDC_ERR_ETYPE_NOSUPP          14   KDC has no support for encryption type
  5471. KDC_ERR_SUMTYPE_NOSUPP          15   KDC has no support for checksum type
  5472. KDC_ERR_PADATA_TYPE_NOSUPP      16   KDC has no support for padata type
  5473.  
  5474.  
  5475. Section    8.3.           - 83    -    Expires 15    October    1993
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.           Version 5 - Revision 5.2
  5483.  
  5484.  
  5485. KDC_ERR_TRTYPE_NOSUPP          17   KDC has no support for transited    type
  5486. KDC_ERR_CLIENT_REVOKED          18   Clients credentials have    been revoked
  5487. KDC_ERR_SERVICE_REVOKED          19   Credentials for server have been    revoked
  5488. KDC_ERR_TGT_REVOKED          20   TGT has been revoked
  5489. KDC_ERR_CLIENT_NOTYET          21   Client not yet valid - try again    later
  5490. KDC_ERR_SERVICE_NOTYET          22   Server not yet valid - try again    later
  5491. KDC_ERR_KEY_EXPIRED          23   Password    has expired - change password to reset
  5492. KDC_ERR_PREAUTH_FAILED          24   Pre-authentication information was invalid
  5493. KDC_ERR_PREAUTH_REQUIRED      25   Additional pre-authenticationrequired-
  5494. KRB_AP_ERR_BAD_INTEGRITY      31   Integrity check on decrypted field failed
  5495. KRB_AP_ERR_TKT_EXPIRED          32   Ticket expired
  5496. KRB_AP_ERR_TKT_NYV          33   Ticket not yet valid
  5497. KRB_AP_ERR_REPEAT          34   Request is a replay
  5498. KRB_AP_ERR_NOT_US          35   The ticket isn't    for us
  5499. KRB_AP_ERR_BADMATCH          36   Ticket and authenticator    don't match
  5500. KRB_AP_ERR_SKEW              37   Clock skew too great
  5501. KRB_AP_ERR_BADADDR          38   Incorrect net address
  5502. KRB_AP_ERR_BADVERSION          39   Protocol    version    mismatch
  5503. KRB_AP_ERR_MSG_TYPE          40   Invalid msg type
  5504. KRB_AP_ERR_MODIFIED          41   Message stream modified
  5505. KRB_AP_ERR_BADORDER          42   Message out of order
  5506. KRB_AP_ERR_BADKEYVER          44   Specified version of key    is not available
  5507. KRB_AP_ERR_NOKEY          45   Service key not available
  5508. KRB_AP_ERR_MUT_FAIL          46   Mutual authentication failed
  5509. KRB_AP_ERR_BADDIRECTION          47   Incorrect message direction
  5510. KRB_AP_ERR_METHOD          48   Alternative authentication method required-
  5511. KRB_AP_ERR_BADSEQ          49   Incorrect sequence number in message
  5512. KRB_AP_ERR_INAPP_CKSUM          50   Inappropriate type of checksum in message
  5513.  
  5514. KRB_ERR_GENERIC              60   Generic error (description in e-text)
  5515. KRB_ERR_FIELD_TOOLONG          61   Field is    too long for this implementation
  5516.  
  5517.  
  5518.  
  5519. 9.  Interoperability requirements
  5520.  
  5521.      Version 5 of the Kerberos protocol    supports a myriad of
  5522. options.   Among  these    are multiple encryption    and checksum
  5523. types, alternative encoding schemes for    the transited field,
  5524. optional  mechanisms for pre-authentication, the handling of
  5525. tickets    with no    addresses, options  for     mutual     authentica-
  5526. tion, user to user authentication, support for proxies,    for-
  5527. warding, postdating, and renewing  tickets,  the  format  of
  5528. realm names, and the handling of authorization data.
  5529.  
  5530.      In    order to ensure    the interoperability of     realms,  it
  5531. is necessary to    define a minimal configuration which must be
  5532. supported by all implementations.  This     minimal  configura-
  5533. tion  is subject to change as technology does.    For example,
  5534. __________________________
  5535.  
  5536. - This error carries additional    information in    the  e-
  5537. data  field.  The contents of the e-data field for this
  5538. message    is described in    section    5.9.1.
  5539.  
  5540.  
  5541. Section    9.           - 84    -    Expires 15    October    1993
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.           Version 5 - Revision 5.2
  5549.  
  5550.  
  5551. if at some later date it  is  discovered  that    one  of     the
  5552. required encryption or checksum    algorithms is not secure, it
  5553. will be    replaced.
  5554.  
  5555. 9.1.  Specification 1
  5556.  
  5557.      This section defines the first specification  of  these
  5558. options.   Implementations  which are configured in this way
  5559. can be said to support Kerberos    Version     5  Specification  1
  5560. (5.1).
  5561.  
  5562. Encryption and checksum    methods
  5563.  
  5564. The following encryption and  checksum    mechanisms  must  be
  5565. supported.   Implementations may support other mechanisms as
  5566. well, but the additional mechanisms may    only  be  used    when
  5567. communicating with principals known to also support them:
  5568. Encryption: DES-CBC-MD5
  5569. Checksums: CRC-32, DES-MAC, DES-MAC-K, and DES-MD5
  5570.  
  5571. Realm Names
  5572.  
  5573. All implementations must understand hierarchical  realms  in
  5574. both the Internet Domain and the X.500 style.  When a ticket
  5575. granting ticket    for an unknown realm is    requested,  the     KDC
  5576. must  be  able    to  determine  the names of the    intermediate
  5577. realms between the KDCs    realm and the requested    realm.
  5578.  
  5579. Transited field    encoding
  5580.  
  5581. DOMAIN-X500-COMPRESS (described    in section 3.3.3.1) must  be
  5582. supported.  Alternative    encodings may be supported, but    they
  5583. may be used only when that  encoding  is  supported  by     ALL
  5584. intermediate realms.
  5585.  
  5586. Pre-authentication methods
  5587.  
  5588. The TGS-REQ method must    be supported.  The TGS-REQ method is
  5589. not  used  on  the  initial  request.    The PA-ENC-TIMESTAMP
  5590. method must be    supported  by  clients    but  whether  it  is
  5591. enabled     by  default  may  be determined on a realm by realm
  5592. basis.    If not used in the initial  request  and  the  error
  5593. KDC_ERR_PREAUTH_REQUIRED   is  returned     specifying  PA-ENC-
  5594. TIMESTAMP as an    acceptable method, the client  should  retry
  5595. the   initial    request      using     the  PA-ENC-TIMESTAMP    pre-
  5596. authentication method.    Servers    need  not  support  the     PA-
  5597. ENC-TIMESTAMP method, but if not supported the server should
  5598. ignore the presence of    PA-ENC-TIMESTAMP  pre-authentication
  5599. in a request.
  5600.  
  5601. Mutual authentication
  5602.  
  5603. Mutual authentication (via the KRB_AP_REP message)  must  be
  5604. supported.
  5605.  
  5606.  
  5607. Section    9.1.           - 85    -    Expires 15    October    1993
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.           Version 5 - Revision 5.2
  5615.  
  5616.  
  5617. Ticket addresses and flags
  5618.  
  5619. All KDC's must pass on tickets that carry no addresses (i.e.
  5620. if  a TGT contains no addresses, the KDC will return deriva-
  5621. tive tickets), but each    realm may set  its  own     policy     for
  5622. issuing     such  tickets,    and each application server will set
  5623. its own    policy with respect to accepting them.    By  default,
  5624. servers    should not accept them.
  5625.  
  5626.      Proxies and forwarded tickets must    be supported.  Indi-
  5627. vidual realms and application servers can set their own    pol-
  5628. icy on when such tickets will be accepted.
  5629.  
  5630.      All implementations must recognize    renewable and  post-
  5631. dated  tickets,     but  need  not    actually implement them.  If
  5632. these options are not supported, the starttime    and  endtime
  5633. in  the     ticket    shall specify a    ticket's entire    useful life.
  5634. When a postdated ticket    is decoded by a    server,     all  imple-
  5635. mentations  shall  make     the  presence of the postdated    flag
  5636. visible    to the calling server.
  5637.  
  5638. User-to-user authentication
  5639.  
  5640. Support    for user to user authentication     (via  the  ENC-TKT-
  5641. IN-SKEY    KDC option) must be provided by    implementations, but
  5642. individual realms may decide as    a matter of policy to reject
  5643. such requests on a per-principal or realm-wide basis.
  5644.  
  5645. Authorization data
  5646.  
  5647. Implementations    must pass all authorization  data  subfields
  5648. from  ticket-granting  tickets    to  any     derivative  tickets
  5649. unless directed    to suppress a subfield as part of the defin-
  5650. ition    of  that  registered  subfield    type  (it  is  never
  5651. incorrect to pass on a subfield, and no    registered  subfield
  5652. types presently    specify    suppression at the KDC).
  5653.  
  5654.      Implementations must make the contents of any  authori-
  5655. zation    data subfields available to the    server when a ticket
  5656. is used.  Implementations are not required to allow  clients
  5657. to specify the contents    of the authorization data fields.
  5658.  
  5659. 9.2.  Recommended KDC values
  5660.  
  5661. Following is a list of recommended values for a     KDC  imple-
  5662. mentation, based on the    list of    suggested configuration    con-
  5663. stants (see section 4.4).
  5664.  
  5665. minimum    lifetime    5 minutes
  5666.  
  5667. maximum    renewable lifetime1 week
  5668.  
  5669. maximum    ticket lifetime1 day
  5670.  
  5671.  
  5672.  
  5673. Section    9.2.           - 86    -    Expires 15    October    1993
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.           Version 5 - Revision 5.2
  5681.  
  5682.  
  5683. empty addresses        only when suitable    restrictions  appear
  5684.             in authorization data
  5685.  
  5686. proxiable, etc.        Allowed.
  5687.  
  5688. 10.  Acknowledgments
  5689.  
  5690.      Early versions of this document, describing  version  4
  5691. of  the    protocol, were written by Jennifer Steiner (formerly
  5692. at Project  Athena);  these  drafts  provided  an  excellent
  5693. starting  point     for  this  current version 5 specification.
  5694. Many people in the Internet community have contributed ideas
  5695. and  suggested protocol    changes    for version 5.    Notable    con-
  5696. tributions  came  from    Ted  Anderson,    Steve  Bellovin     and
  5697. Michael    Merritt    [17], Daniel Bernstein,    Mike Burrows, Donald
  5698. Davis, Ravi Ganesan,  Morrie  Gasser,  Virgil  Gligor,    Bill
  5699. Griffeth,  Mark     Lillibridge,  Mark Lomas, Steve Lunt, Piers
  5700. McMahon, Joe Pato, William Sommerfeld,    Stuart    Stubblebine,
  5701. Ralph  Swick,  Ted T'so, and Stanley Zanarotti.     Many others
  5702. commented and  helped  shape  this  specification  into     its
  5703. current    form.
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739. Section    10.           - 87    -    Expires 15    October    1993
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.           Version 5 - Revision 5.2
  5747.  
  5748.  
  5749. 11.  REFERENCES
  5750.  
  5751.  
  5752.  
  5753. 1.   S.    P. Miller, B. C. Neuman, J. I. Schiller, and  J.  H.
  5754.      Saltzer,  Section    E.2.1:    Kerberos  Authentication and
  5755.      Authorization System, M.I.T. Project Athena, Cambridge,
  5756.      Massachusetts (December 21, 1987).
  5757.  
  5758. 2.   J.    G. Steiner, B. C. Neuman, and J. I. Schiller,  "Ker-
  5759.      beros:  An    Authentication Service for Open    Network    Sys-
  5760.      tems," pp.    191-202    in  Usenix  Conference    Proceedings,
  5761.      Dallas, Texas (February, 1988).
  5762.  
  5763. 3.   Roger M.  Needham    and  Michael  D.  Schroeder,  "Using
  5764.      Encryption    for Authentication in Large Networks of    Com-
  5765.      puters,"  Communications  of  the    ACM,  Vol.   21(12),
  5766.      pp. 993-999 (December, 1978).
  5767.  
  5768. 4.   Dorothy E.    Denning    and  Giovanni  Maria  Sacco,  "Time-
  5769.      stamps  in     Key Distribution Protocols," Communications
  5770.      of    the ACM, Vol. 24(8), pp. 533-536 (August 1981).
  5771.  
  5772. 5.   John T. Kohl, B. Clifford Neuman, and Theodore Y. Ts'o,
  5773.      "The Evolution of the Kerberos Authentication Service,"
  5774.      in    an IEEE    Computer Society Text soon to  be  published
  5775.      (June 1992).
  5776.  
  5777. 6.   Don Davis and Ralph Swick,     "Workstation  Services     and
  5778.      Kerberos  Authentication  at Project Athena," Technical
  5779.      Memorandum    TM-424,     MIT Laboratory    for Computer Science
  5780.      (February 1990).
  5781.  
  5782. 7.   P.    J. Levine, M. R. Gretzinger, J.    M. Diaz, W. E.    Som-
  5783.      merfeld,  and  K. Raeburn,    Section    E.1: Service Manage-
  5784.      ment System, M.I.T.  Project  Athena,  Cambridge,    Mas-
  5785.      sachusetts    (1987).
  5786.  
  5787. 8.   CCITT, Recommendation X.509: The Directory     Authentica-
  5788.      tion Framework, December 1988.
  5789.  
  5790. 9.   B.     Clifford  Neuman,  "Proxy-Based  Authorization     and
  5791.      Accounting     for Distributed Systems," in Proceedings of
  5792.      the 13th International Conference on  Distributed    Com-
  5793.      puting Systems, Pittsburgh, PA (May, 1993).
  5794.  
  5795. 10.  J.    Pato, Using  Pre-Authentication     to  Avoid  Password
  5796.      Guessing  Attacks,    Open Software Foundation DCE Request
  5797.      for Comments 26 (December 1992).
  5798.  
  5799. 11.  National Bureau of    Standards, U.S.    Department  of    Com-
  5800.      merce,  "Data Encryption Standard," Federal Information
  5801.      Processing    Standards Publication  46,   Washington,  DC
  5802.      (1977).
  5803.  
  5804.  
  5805. Section    11.           - 88    -    Expires 15    October    1993
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.           Version 5 - Revision 5.2
  5813.  
  5814.  
  5815. 12.  National Bureau of    Standards, U.S.    Department  of    Com-
  5816.      merce,  "DES  Modes  of Operation," Federal Information
  5817.      Processing    Standards Publication 81,   Springfield,  VA
  5818.      (December 1980).
  5819.  
  5820. 13.  Stuart G. Stubblebine and Virgil D. Gligor, "On Message
  5821.      Integrity    in  Cryptographic Protocols," in Proceedings
  5822.      of    the IEEE  Symposium  on     Research  in  Security     and
  5823.      Privacy, Oakland, California (May 1992).
  5824.  
  5825. 14.  International Organization     for  Standardization,    "ISO
  5826.      Information  Processing  Systems -    Data Communication -
  5827.      High-Level    Data Link Control Procedure -  Frame  Struc-
  5828.      ture," IS 3309 (October 1984).  3rd Edition.
  5829.  
  5830. 15.  R.    Rivest,    "The  MD4  Message  Digest  Algorithm,"     RFC
  5831.      1320,   MIT  Laboratory  for  Computer  Science  (April
  5832.      1992).
  5833.  
  5834. 16.  R.    Rivest,    "The  MD5  Message  Digest  Algorithm,"     RFC
  5835.      1321,   MIT  Laboratory  for  Computer  Science  (April
  5836.      1992).
  5837.  
  5838. 17.  S.    M. Bellovin and    M. Merritt, "Limitations of the    Ker-
  5839.      beros  Authentication  System," Computer Communications
  5840.      Review, Vol. 20(5), pp. 119-132 (October 1990).
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871. Section    11.           - 89    -    Expires 15    October    1993
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.           Version 5 - Revision 5.2
  5879.  
  5880.  
  5881. A.  Pseudo-code    for protocol processing
  5882.  
  5883.      This appendix provides pseudo-code    describing  how     the
  5884. messages  are  to  be constructed and interpreted by clients
  5885. and servers.
  5886.  
  5887. A.1.  KRB_AS_REQ generation
  5888.     request.pvno :=    protocol version; /* pvno = 5 */
  5889.     request.msg-type := message type; /* type = KRB_AS_REQ */
  5890.  
  5891.     if(pa_enc_timestamp_required) then
  5892.         request.padata.padata-type = PA-ENC-TIMESTAMP;
  5893.         get system_time;
  5894.         padata-body.patimestamp,pausec = system_time;
  5895.         encrypt    padata-body into request.padata.padata-value
  5896.             using client.key; /* derived from password */
  5897.     endif
  5898.  
  5899.     body.kdc-options := users's preferences;
  5900.     body.cname := user's name;
  5901.     body.realm := user's realm;
  5902.     body.sname := service's    name; /* usually "krbtgt",  "localrealm" */
  5903.     if (body.kdc-options.POSTDATED is set) then
  5904.         body.from := requested starting    time;
  5905.     else
  5906.         omit body.from;
  5907.     endif
  5908.     body.till := requested end time;
  5909.     if (body.kdc-options.RENEWABLE is set) then
  5910.         body.rtime := requested    final renewal time;
  5911.     endif
  5912.     body.nonce := random_nonce();
  5913.     body.etype := requested    etypes;
  5914.     if (user supplied addresses) then
  5915.         body.addresses := user's addresses;
  5916.     else
  5917.         omit body.addresses;
  5918.     endif
  5919.     omit body.enc-authorization-data;
  5920.     request.req-body := body;
  5921.  
  5922.     kerberos := lookup(name    of local kerberos server (or servers));
  5923.     send(packet,kerberos);
  5924.  
  5925.     wait(for response);
  5926.     if (timed_out) then
  5927.         retry or use alternate server;
  5928.     endif
  5929.  
  5930. A.2.  KRB_AS_REQ verification and KRB_AS_REP generation
  5931.     decode message into req;
  5932.  
  5933.     client := lookup(req.cname,req.realm);
  5934.     server := lookup(req.sname,req.realm);
  5935.  
  5936.  
  5937. Section    A.2.           - 90    -    Expires 15    October    1993
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.           Version 5 - Revision 5.2
  5945.  
  5946.  
  5947.  
  5948.     get system_time;
  5949.     kdc_time := system_time.seconds;
  5950.  
  5951.     if (!client) then
  5952.         /* no client in    Database */
  5953.         error_out(KDC_ERR_C_PRINCIPAL_UNKNOWN);
  5954.     endif
  5955.     if (!server) then
  5956.         /* no server in    Database */
  5957.         error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  5958.     endif
  5959.  
  5960.     if(client.pa_enc_timestamp_required and
  5961.        pa_enc_timestamp not    present) then
  5962.         error_out(KDC_ERR_PREAUTH_REQUIRED(PA_ENC_TIMESTAMP));
  5963.     endif
  5964.  
  5965.     if(pa_enc_timestamp present) then
  5966.         decrypt    req.padata-value into decrypted_enc_timestamp
  5967.             using client.key;
  5968.             using auth_hdr.authenticator.subkey;
  5969.         if (decrypt_error()) then
  5970.             error_out(KRB_AP_ERR_BAD_INTEGRITY);
  5971.         if(decrypted_enc_timestamp is not within allowable skew) then
  5972.             error_out(KDC_ERR_PREAUTH_FAILED);
  5973.         endif
  5974.         if(decrypted_enc_timestamp and usec is replay)
  5975.             error_out(KDC_ERR_PREAUTH_FAILED);
  5976.         endif
  5977.         add decrypted_enc_timestamp and    usec to    replay cache;
  5978.     endif
  5979.  
  5980.     use_etype := first supported etype in req.etypes;
  5981.  
  5982.     if (no support for req.etypes) then
  5983.         error_out(KDC_ERR_ETYPE_NOSUPP);
  5984.     endif
  5985.  
  5986.     new_tkt.vno := ticket version; /* = 5 */
  5987.     new_tkt.sname := req.sname;
  5988.     new_tkt.srealm := req.srealm;
  5989.     reset all flags    in new_tkt.flags;
  5990.  
  5991.     /* It should be    noted that local policy    may affect the    */
  5992.     /* processing of any of    these flags.  For example, some    */
  5993.     /* realms may refuse to    issue renewable    tickets        */
  5994.  
  5995.     if (req.kdc-options.FORWARDABLE    is set)    then
  5996.         set new_tkt.flags.FORWARDABLE;
  5997.     endif
  5998.     if (req.kdc-options.PROXIABLE is set) then
  5999.         set new_tkt.flags.PROXIABLE;
  6000.     endif
  6001.  
  6002.  
  6003. Section    A.2.           - 91    -    Expires 15    October    1993
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.           Version 5 - Revision 5.2
  6011.  
  6012.  
  6013.     if (req.kdc-options.ALLOW-POSTDATE is set) then
  6014.         set new_tkt.flags.ALLOW-POSTDATE;
  6015.     endif
  6016.     if ((req.kdc-options.RENEW is set) or
  6017.         (req.kdc-options.VALIDATE is set) or
  6018.         (req.kdc-options.PROXY is set) or
  6019.         (req.kdc-options.FORWARDED is set) or
  6020.         (req.kdc-options.ENC-TKT-IN-SKEY is    set)) then
  6021.         error_out(KDC_ERR_BADOPTION);
  6022.     endif
  6023.  
  6024.     new_tkt.session    := random_session_key();
  6025.     new_tkt.cname := req.cname;
  6026.     new_tkt.crealm := req.crealm;
  6027.     new_tkt.transited := empty_transited_field();
  6028.  
  6029.     new_tkt.authtime := kdc_time;
  6030.  
  6031.     if (req.kdc-options.POSTDATED is set) then
  6032.        if (against_postdate_policy(req.from)) then
  6033.         error_out(KDC_ERR_POLICY);
  6034.        endif
  6035.        set new_tkt.flags.INVALID;
  6036.        new_tkt.starttime :=    req.from;
  6037.     else
  6038.        omit    new_tkt.starttime; /* treated as authtime when omitted */
  6039.     endif
  6040.     if (req.till = 0) then
  6041.         till :=    infinity;
  6042.     else
  6043.         till :=    req.till;
  6044.     endif
  6045.  
  6046.     new_tkt.endtime    := min(till,
  6047.                   new_tkt.starttime+client.max_life,
  6048.                   new_tkt.starttime+server.max_life,
  6049.                   new_tkt.starttime+max_life_for_realm);
  6050.  
  6051.     if ((req.kdc-options.RENEWABLE-OK is set) and
  6052.         (new_tkt.endtime < req.till)) then
  6053.         /* we set the RENEWABLE    option for later processing */
  6054.         set req.kdc-options.RENEWABLE;
  6055.         req.rtime := req.till;
  6056.     endif
  6057.  
  6058.     if (req.rtime =    0) then
  6059.         rtime := infinity;
  6060.     else
  6061.         rtime := req.rtime;
  6062.     endif
  6063.  
  6064.     if (req.kdc-options.RENEWABLE is set) then
  6065.         set new_tkt.flags.RENEWABLE;
  6066.         new_tkt.renew-till := min(rtime,
  6067.  
  6068.  
  6069. Section    A.2.           - 92    -    Expires 15    October    1993
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.           Version 5 - Revision 5.2
  6077.  
  6078.  
  6079.                       new_tkt.starttime+client.max_rlife,
  6080.                       new_tkt.starttime+server.max_rlife,
  6081.                       new_tkt.starttime+max_rlife_for_realm);
  6082.     else
  6083.         omit new_tkt.renew-till; /* only present if RENEWABLE */
  6084.     endif
  6085.  
  6086.     if (req.addresses) then
  6087.         new_tkt.caddr := req.addresses;
  6088.     else
  6089.         omit new_tkt.caddr;
  6090.     endif
  6091.  
  6092.     new_tkt.authorization_data := empty_authorization_data();
  6093.  
  6094.     encode to-be-encrypted part of ticket into OCTET STRING;
  6095.     new_tkt.enc-part := encrypt OCTET STRING
  6096.         using etype_for_key(server.key), server.key, server.p_kvno;
  6097.  
  6098.  
  6099.     /* Start processing the    response */
  6100.  
  6101.     resp.pvno := 5;
  6102.     resp.msg-type := KRB_AS_REP;
  6103.     resp.cname := req.cname;
  6104.     resp.crealm := req.realm;
  6105.     resp.ticket := new_tkt;
  6106.  
  6107.     resp.key := new_tkt.session;
  6108.     resp.last-req := fetch_last_request_info(client);
  6109.     resp.nonce := req.nonce;
  6110.     resp.key-expiration := client.expiration;
  6111.     resp.flags := new_tkt.flags;
  6112.  
  6113.     resp.authtime := new_tkt.authtime;
  6114.     resp.starttime := new_tkt.starttime;
  6115.     resp.endtime :=    new_tkt.endtime;
  6116.  
  6117.     if (new_tkt.flags.RENEWABLE) then
  6118.         resp.renew-till    := new_tkt.renew-till;
  6119.     endif
  6120.  
  6121.     resp.realm := new_tkt.realm;
  6122.     resp.sname := new_tkt.sname;
  6123.  
  6124.     resp.caddr := new_tkt.caddr;
  6125.  
  6126.     encode body of reply into OCTET    STRING;
  6127.  
  6128.     resp.enc-part := encrypt OCTET STRING
  6129.              using use_etype, client.key, client.p_kvno;
  6130.     send(resp);
  6131.  
  6132.  
  6133.  
  6134.  
  6135. Section    A.2.           - 93    -    Expires 15    October    1993
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.           Version 5 - Revision 5.2
  6143.  
  6144.  
  6145. A.3.  KRB_AS_REP verification
  6146.     decode response    into resp;
  6147.  
  6148.     if (resp.msg-type = KRB_ERROR) then
  6149.         if(error = KDC_ERR_PREAUTH_REQUIRED(PA_ENC_TIMESTAMP)) then
  6150.             set pa_enc_timestamp_required;
  6151.             goto KRB_AS_REQ;
  6152.         endif
  6153.         process_error(resp);
  6154.         return;
  6155.     endif
  6156.  
  6157.     /* On error, discard the response, and zero the    session    key */
  6158.     /* from    the response immediately */
  6159.  
  6160.     key = get_decryption_key(resp.enc-part.kvno, resp.enc-part.etype,
  6161.                  resp.padata);
  6162.     unencrypted part of resp := decode of decrypt of resp.enc-part
  6163.                 using resp.enc-part.etype and key;
  6164.     zero(key);
  6165.  
  6166.     if (common_as_rep_tgs_rep_checks fail) then
  6167.         destroy    resp.key;
  6168.         return error;
  6169.     endif
  6170.  
  6171.     if near(resp.princ_exp)    then
  6172.         print(warning message);
  6173.     endif
  6174.     save_for_later(ticket,session,client,server,times,flags);
  6175.  
  6176. A.4.  KRB_AS_REP and KRB_TGS_REP common    checks
  6177.     if (decryption_error() or
  6178.         (req.cname != resp.cname) or
  6179.         (req.realm != resp.crealm) or
  6180.         (req.sname != resp.sname) or
  6181.         (req.realm != resp.realm) or
  6182.         (req.nonce != resp.nonce) or
  6183.         (req.addresses != resp.caddr)) then
  6184.         destroy    resp.key;
  6185.         return KRB_AP_ERR_MODIFIED;
  6186.     endif
  6187.  
  6188.     /* make    sure no    flags are set that shouldn't be, and that all that */
  6189.     /* should be are set                           */
  6190.     if (!check_flags_for_compatability(req.kdc-options,resp.flags))    then
  6191.         destroy    resp.key;
  6192.         return KRB_AP_ERR_MODIFIED;
  6193.     endif
  6194.  
  6195.     if ((req.from =    0) and
  6196.         (resp.starttime is not within allowable skew)) then
  6197.         destroy    resp.key;
  6198.         return KRB_AP_ERR_SKEW;
  6199.  
  6200.  
  6201. Section    A.4.           - 94    -    Expires 15    October    1993
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.           Version 5 - Revision 5.2
  6209.  
  6210.  
  6211.     endif
  6212.     if ((req.from != 0) and    (req.from != resp.starttime)) then
  6213.         destroy    resp.key;
  6214.         return KRB_AP_ERR_MODIFIED;
  6215.     endif
  6216.     if ((req.till != 0) and    (resp.endtime >    req.till)) then
  6217.         destroy    resp.key;
  6218.         return KRB_AP_ERR_MODIFIED;
  6219.     endif
  6220.  
  6221.     if ((req.kdc-options.RENEWABLE is set) and
  6222.         (req.rtime != 0) and (resp.renew-till > req.rtime))    then
  6223.         destroy    resp.key;
  6224.         return KRB_AP_ERR_MODIFIED;
  6225.     endif
  6226.     if ((req.kdc-options.RENEWABLE-OK is set) and
  6227.         (resp.flags.RENEWABLE) and
  6228.         (req.till != 0) and
  6229.         (resp.renew-till > req.till)) then
  6230.         destroy    resp.key;
  6231.         return KRB_AP_ERR_MODIFIED;
  6232.     endif
  6233.  
  6234. A.5.  KRB_TGS_REQ generation
  6235.     /* Note    that make_application_request might have to recursivly       */
  6236.     /* call    this routine to    get the    appropriate ticket-granting ticket */
  6237.  
  6238.     request.pvno :=    protocol version; /* pvno = 5 */
  6239.     request.msg-type := message type; /* type = KRB_TGS_REQ    */
  6240.  
  6241.     body.kdc-options := users's preferences;
  6242.     /* If the TGT is not for the realm of the end-server  */
  6243.     /* then    the sname will be for a    TGT for    the end-realm */
  6244.     /* and the realm of the    requested ticket (body.realm) */
  6245.     /* will    be that    of the TGS to which the    TGT we are    */
  6246.     /* sending applies                      */
  6247.     body.sname := service's    name;
  6248.     body.realm := service's    realm;
  6249.  
  6250.     if (body.kdc-options.POSTDATED is set) then
  6251.         body.from := requested starting    time;
  6252.     else
  6253.         omit body.from;
  6254.     endif
  6255.     body.till := requested end time;
  6256.     if (body.kdc-options.RENEWABLE is set) then
  6257.         body.rtime := requested    final renewal time;
  6258.     endif
  6259.     body.nonce := random_nonce();
  6260.     body.etype := requested    etypes;
  6261.     if (user supplied addresses) then
  6262.         body.addresses := user's addresses;
  6263.     else
  6264.         omit body.addresses;
  6265.  
  6266.  
  6267. Section    A.5.           - 95    -    Expires 15    October    1993
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.           Version 5 - Revision 5.2
  6275.  
  6276.  
  6277.     endif
  6278.  
  6279.     body.enc-authorization-data := user-supplied data;
  6280.     if (body.kdc-options.ENC-TKT-IN-SKEY) then
  6281.         body.additional-tickets_ticket := second TGT;
  6282.     endif
  6283.  
  6284.     request.req-body := body;
  6285.     check := generate_checksum (req.body,checksumtype);
  6286.  
  6287.     request.padata[0].padata-type := PA-TGS-REQ;
  6288.     request.padata[0].padata-value := create a KRB_AP_REQ using
  6289.                       the TGT and checksum
  6290.  
  6291.     /* add in any other padata as required/supplied    */
  6292.  
  6293.     kerberos := lookup(name    of local kerberose server (or servers));
  6294.     send(packet,kerberos);
  6295.  
  6296.     wait(for response);
  6297.     if (timed_out) then
  6298.         retry or use alternate server;
  6299.     endif
  6300.  
  6301. A.6.  KRB_TGS_REQ verification and KRB_TGS_REP generation
  6302.     /* note    that reading the application request requires first
  6303.     determining the    server for which a ticket was issued, and choosing the
  6304.     correct    key for    decryption.  The name of the server appears in the
  6305.     plaintext part of the ticket. */
  6306.  
  6307.     if (no KRB_AP_REQ in req.padata) then
  6308.         error_out(KDC_ERR_PADATA_TYPE_NOSUPP);
  6309.     endif
  6310.     verify KRB_AP_REQ in req.padata;
  6311.  
  6312.     /* Note    that the realm in which    the Kerberos server is operating is
  6313.     determined by the instance from    the ticket-granting ticket.  The realm
  6314.     in the ticket-granting ticket is the realm under which the ticket
  6315.     granting ticket    was issued.  It    is possible for    a single Kerberos
  6316.     server to support more than one    realm. */
  6317.  
  6318.     auth_hdr := KRB_AP_REQ;
  6319.     tgt := auth_hdr.ticket;
  6320.  
  6321.     if (tgt.sname is not a TGT for local realm and is not req.sname) then
  6322.         error_out(KRB_AP_ERR_NOT_US);
  6323.  
  6324.     realm := realm_tgt_is_for(tgt);
  6325.  
  6326.     decode remainder of request;
  6327.  
  6328.     if (auth_hdr.authenticator.cksum is missing) then
  6329.         error_out(KRB_AP_ERR_INAPP_CKSUM);
  6330.     endif
  6331.  
  6332.  
  6333. Section    A.6.           - 96    -    Expires 15    October    1993
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.           Version 5 - Revision 5.2
  6341.  
  6342.  
  6343.     if (auth_hdr.authenticator.cksum type is not supported)    then
  6344.         error_out(KDC_ERR_SUMTYPE_NOSUPP);
  6345.     endif
  6346.     if (auth_hdr.authenticator.cksum is not    both collision-proof and keyed)    then
  6347.         error_out(KRB_AP_ERR_INAPP_CKSUM);
  6348.     endif
  6349.  
  6350.     set computed_checksum := checksum(req);
  6351.     if (computed_checksum != auth_hdr.authenticatory.cksum)    then
  6352.         error_out(KRB_AP_ERR_MODIFIED);
  6353.     endif
  6354.  
  6355.     server := lookup(req.sname,realm);
  6356.  
  6357.     if (!server) then
  6358.         if (is_foreign_tgt_name(server)) then
  6359.             server := best_intermediate_tgs(server);
  6360.         else
  6361.             /* no server in    Database */
  6362.             error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  6363.         endif
  6364.     endif
  6365.  
  6366.     session    := generate_random_session_key();
  6367.  
  6368.  
  6369.     use_etype := first supported etype in req.etypes;
  6370.  
  6371.     if (no support for req.etypes) then
  6372.         error_out(KDC_ERR_ETYPE_NOSUPP);
  6373.     endif
  6374.  
  6375.     new_tkt.vno := ticket version; /* = 5 */
  6376.     new_tkt.sname := req.sname;
  6377.     new_tkt.srealm := realm;
  6378.     reset all flags    in new_tkt.flags;
  6379.  
  6380.     /* It should be    noted that local policy    may affect the    */
  6381.     /* processing of any of    these flags.  For example, some    */
  6382.     /* realms may refuse to    issue renewable    tickets        */
  6383.  
  6384.     new_tkt.caddr := tgt.caddr;
  6385.     resp.caddr := NULL; /* We only include this if they change */
  6386.     if (req.kdc-options.FORWARDABLE    is set)    then
  6387.         if (tgt.flags.FORWARDABLE is reset) then
  6388.             error_out(KDC_ERR_BADOPTION);
  6389.         endif
  6390.         set new_tkt.flags.FORWARDABLE;
  6391.     endif
  6392.     if (req.kdc-options.FORWARDED is set) then
  6393.         if (tgt.flags.FORWARDABLE is reset) then
  6394.             error_out(KDC_ERR_BADOPTION);
  6395.         endif
  6396.         set new_tkt.flags.FORWARDED;
  6397.  
  6398.  
  6399. Section    A.6.           - 97    -    Expires 15    October    1993
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.           Version 5 - Revision 5.2
  6407.  
  6408.  
  6409.         new_tkt.caddr := req.addresses;
  6410.         resp.caddr := req.addresses;
  6411.     endif
  6412.     if (tgt.flags.FORWARDED    is set)    then
  6413.         set new_tkt.flags.FORWARDED;
  6414.     endif
  6415.  
  6416.     if (req.kdc-options.PROXIABLE is set) then
  6417.         if (tgt.flags.PROXIABLE    is reset)
  6418.             error_out(KDC_ERR_BADOPTION);
  6419.         endif
  6420.         set new_tkt.flags.PROXIABLE;
  6421.     endif
  6422.     if (req.kdc-options.PROXY is set) then
  6423.         if (tgt.flags.PROXIABLE    is reset) then
  6424.             error_out(KDC_ERR_BADOPTION);
  6425.         endif
  6426.         set new_tkt.flags.PROXY;
  6427.         new_tkt.caddr := req.addresses;
  6428.         resp.caddr := req.addresses;
  6429.     endif
  6430.  
  6431.     if (req.kdc-options.POSTDATE is    set) then
  6432.         if (tgt.flags.POSTDATE is reset)
  6433.             error_out(KDC_ERR_BADOPTION);
  6434.         endif
  6435.         set new_tkt.flags.POSTDATE;
  6436.     endif
  6437.     if (req.kdc-options.POSTDATED is set) then
  6438.         if (tgt.flags.POSTDATE is reset) then
  6439.             error_out(KDC_ERR_BADOPTION);
  6440.         endif
  6441.         set new_tkt.flags.POSTDATED;
  6442.         set new_tkt.flags.INVALID;
  6443.         if (against_postdate_policy(req.from)) then
  6444.             error_out(KDC_ERR_POLICY);
  6445.         endif
  6446.         new_tkt.starttime := req.from;
  6447.     endif
  6448.  
  6449.  
  6450.     if (req.kdc-options.VALIDATE is    set) then
  6451.         if (tgt.flags.INVALID is reset)    then
  6452.             error_out(KDC_ERR_POLICY);
  6453.         endif
  6454.         if (tgt.starttime > kdc_time) then
  6455.             error_out(KRB_AP_ERR_NYV);
  6456.         endif
  6457.         if (check_hot_list(tgt)) then
  6458.             error_out(KRB_AP_ERR_REPEAT);
  6459.         endif
  6460.         tkt := tgt;
  6461.         reset new_tkt.flags.INVALID;
  6462.     endif
  6463.  
  6464.  
  6465. Section    A.6.           - 98    -    Expires 15    October    1993
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.           Version 5 - Revision 5.2
  6473.  
  6474.  
  6475.     if (req.kdc-options.(any flag except ENC-TKT-IN-SKEY, RENEW,
  6476.                  and those already processed) is set) then
  6477.         error_out(KDC_ERR_BADOPTION);
  6478.     endif
  6479.  
  6480.     new_tkt.authtime := tgt.authtime;
  6481.  
  6482.     if (req.kdc-options.RENEW is set) then
  6483.       /* Note that if the endtime has already passed, the ticket would  */
  6484.       /* have been rejected    in the initial authentication stage, so        */
  6485.       /* there is no need to check again here                */
  6486.         if (tgt.flags.RENEWABLE    is reset) then
  6487.             error_out(KDC_ERR_BADOPTION);
  6488.         endif
  6489.         if (tgt.renew-till >= kdc_time)    then
  6490.             error_out(KRB_AP_ERR_TKT_EXPIRED);
  6491.         endif
  6492.         tkt := tgt;
  6493.         new_tkt.starttime := kdc_time;
  6494.         old_life := tgt.endttime - tgt.starttime;
  6495.         new_tkt.endtime    := min(tgt.renew-till,
  6496.                        new_tkt.starttime + old_life);
  6497.     else
  6498.         new_tkt.starttime := kdc_time;
  6499.         if (req.till = 0) then
  6500.             till :=    infinity;
  6501.         else
  6502.             till :=    req.till;
  6503.         endif
  6504.         new_tkt.endtime    := min(till,
  6505.                        new_tkt.starttime+client.max_life,
  6506.                        new_tkt.starttime+server.max_life,
  6507.                        new_tkt.starttime+max_life_for_realm,
  6508.                        tgt.endtime);
  6509.  
  6510.         if ((req.kdc-options.RENEWABLE-OK is set) and
  6511.             (new_tkt.endtime < req.till) and
  6512.             (tgt.flags.RENEWABLE is set) then
  6513.             /* we set the RENEWABLE    option for later processing */
  6514.             set req.kdc-options.RENEWABLE;
  6515.             req.rtime := min(req.till, tgt.renew-till);
  6516.         endif
  6517.     endif
  6518.  
  6519.     if (req.rtime =    0) then
  6520.         rtime := infinity;
  6521.     else
  6522.         rtime := req.rtime;
  6523.     endif
  6524.  
  6525.     if ((req.kdc-options.RENEWABLE is set) and
  6526.         (tgt.flags.RENEWABLE is set)) then
  6527.         set new_tkt.flags.RENEWABLE;
  6528.         new_tkt.renew-till := min(rtime,
  6529.  
  6530.  
  6531. Section    A.6.           - 99    -    Expires 15    October    1993
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.           Version 5 - Revision 5.2
  6539.  
  6540.  
  6541.                       new_tkt.starttime+client.max_rlife,
  6542.                       new_tkt.starttime+server.max_rlife,
  6543.                       new_tkt.starttime+max_rlife_for_realm,
  6544.                       tgt.renew-till);
  6545.     else
  6546.         new_tkt.renew-till := OMIT; /* leave the renew-till field out */
  6547.     endif
  6548.     if (req.enc-authorization-data is present) then
  6549.         decrypt    req.enc-authorization-data into    decrypted_authorization_data
  6550.             using auth_hdr.authenticator.subkey;
  6551.         if (decrypt_error()) then
  6552.             error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6553.         endif
  6554.     endif
  6555.     new_tkt.authorization_data := req.auth_hdr.ticket.authorization_data +
  6556.                  decrypted_authorization_data;
  6557.  
  6558.     new_tkt.key := session;
  6559.     new_tkt.crealm := tgt.crealm;
  6560.     new_tkt.cname := req.auth_hdr.ticket.cname;
  6561.  
  6562.     if (realm_tgt_is_for(tgt) := tgt.realm)    then
  6563.         /* tgt issued by local realm */
  6564.         new_tkt.transited := tgt.transited;
  6565.     else
  6566.         /* was issued for this realm by    some other realm */
  6567.         if (tgt.transited.tr-type not supported) then
  6568.             error_out(KDC_ERR_TRTYPE_NOSUPP);
  6569.         endif
  6570.         new_tkt.transited := compress_transited(tgt.transited +    tgt.realm)
  6571.     endif
  6572.  
  6573.     encode encrypted part of new_tkt into OCTET STRING;
  6574.     if (req.kdc-options.ENC-TKT-IN-SKEY is set) then
  6575.         if (server not specified) then
  6576.             server = req.second_ticket.client;
  6577.         endif
  6578.         if ((req.second_ticket is not a    TGT) or
  6579.             (req.second_ticket.client != server)) then
  6580.             error_out(KDC_ERR_POLICY);
  6581.         endif
  6582.  
  6583.         new_tkt.enc-part := encrypt OCTET STRING using
  6584.             using etype_for_key(second-ticket.key),    second-ticket.key;
  6585.     else
  6586.         new_tkt.enc-part := encrypt OCTET STRING
  6587.             using etype_for_key(server.key), server.key, server.p_kvno;
  6588.     endif
  6589.  
  6590.     resp.pvno := 5;
  6591.     resp.msg-type := KRB_TGS_REP;
  6592.     resp.crealm := tgt.crealm;
  6593.     resp.cname := tgt.cname;
  6594.  
  6595.  
  6596.  
  6597. Section    A.6.          - 100    -    Expires 15    October    1993
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.           Version 5 - Revision 5.2
  6605.  
  6606.  
  6607.     resp.ticket := new_tkt;
  6608.  
  6609.     resp.key := session;
  6610.     resp.nonce := req.nonce;
  6611.     resp.last-req := fetch_last_request_info(client);
  6612.     resp.flags := new_tkt.flags;
  6613.  
  6614.     resp.authtime := new_tkt.authtime;
  6615.     resp.starttime := new_tkt.starttime;
  6616.     resp.endtime :=    new_tkt.endtime;
  6617.  
  6618.     omit resp.key-expiration;
  6619.  
  6620.     resp.sname := new_tkt.sname;
  6621.     resp.realm := new_tkt.realm;
  6622.  
  6623.     if (new_tkt.flags.RENEWABLE) then
  6624.         resp.renew-till    := new_tkt.renew-till;
  6625.     endif
  6626.  
  6627.  
  6628.     encode body of reply into OCTET    STRING;
  6629.  
  6630.     if (req.padata.authenticator.subkey)
  6631.         resp.enc-part := encrypt OCTET STRING using use_etype,
  6632.             req.padata.authenticator.subkey;
  6633.     else resp.enc-part := encrypt OCTET STRING using use_etype, tgt.key;
  6634.  
  6635.     send(resp);
  6636.  
  6637. A.7.  KRB_TGS_REP verification
  6638.     decode response    into resp;
  6639.  
  6640.     if (resp.msg-type = KRB_ERROR) then
  6641.         process_error(resp);
  6642.         return;
  6643.     endif
  6644.  
  6645.     /* On error, discard the response, and zero the    session    key from
  6646.     the response immediately */
  6647.  
  6648.     if (req.padata.authenticator.subkey)
  6649.         unencrypted part of resp := decode of decrypt of resp.enc-part
  6650.             using resp.enc-part.etype and subkey;
  6651.     else unencrypted part of resp := decode    of decrypt of resp.enc-part
  6652.                 using resp.enc-part.etype and tgt's session key;
  6653.     if (common_as_rep_tgs_rep_checks fail) then
  6654.         destroy    resp.key;
  6655.         return error;
  6656.     endif
  6657.  
  6658.     check authorization_data as necessary;
  6659.     save_for_later(ticket,session,client,server,times,flags);
  6660.  
  6661.  
  6662.  
  6663. Section    A.7.          - 101    -    Expires 15    October    1993
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.           Version 5 - Revision 5.2
  6671.  
  6672.  
  6673. A.8.  Authenticator generation
  6674.     body.authenticator-vno := authenticator    vno; /*    = 5 */
  6675.     body.cname, body.crealm    := client name;
  6676.     if (supplying checksum)    then
  6677.         body.cksum := checksum;
  6678.     endif
  6679.     get system_time;
  6680.     body.ctime, body.cusec := system_time;
  6681.     if (selecting sub-session key) then
  6682.         select sub-session key;
  6683.         body.subkey := sub-session key;
  6684.     endif
  6685.     if (using sequence numbers) then
  6686.         select initial sequence    number;
  6687.         body.seq-number    := initial sequence;
  6688.     endif
  6689.  
  6690. A.9.  KRB_AP_REQ generation
  6691.     obtain ticket and session_key from cache;
  6692.  
  6693.     packet.pvno := protocol    version; /* 5 */
  6694.     packet.msg-type    := message type; /* KRB_AP_REQ */
  6695.  
  6696.     if (desired(MUTUAL_AUTHENTICATION)) then
  6697.         set packet.ap-options.MUTUAL-REQUIRED;
  6698.     else
  6699.         reset packet.ap-options.MUTUAL-REQUIRED;
  6700.     endif
  6701.     if (using session key for ticket) then
  6702.         set packet.ap-options.USE-SESSION-KEY;
  6703.     else
  6704.         reset packet.ap-options.USE-SESSION-KEY;
  6705.     endif
  6706.     packet.ticket := ticket; /* ticket */
  6707.     generate authenticator;
  6708.     encode authenticator into OCTET    STRING;
  6709.     encrypt    OCTET STRING into packet.authenticator using session_key;
  6710.  
  6711. A.10.  KRB_AP_REQ verification
  6712.     receive    packet;
  6713.     if (packet.pvno    != 5) then
  6714.         either process using other protocol spec
  6715.         or error_out(KRB_AP_ERR_BADVERSION);
  6716.     endif
  6717.     if (packet.msg-type != KRB_AP_REQ) then
  6718.         error_out(KRB_AP_ERR_MSG_TYPE);
  6719.     endif
  6720.     if (packet.ticket.tkt_vno != 5)    then
  6721.         either process using other protocol spec
  6722.         or error_out(KRB_AP_ERR_BADVERSION);
  6723.     endif
  6724.     if (packet.ap_options.USE-SESSION-KEY is set) then
  6725.         retrieve session key from ticket-granting ticket for
  6726.          packet.ticket.{sname,srealm,enc-part.etype};
  6727.  
  6728.  
  6729. Section    A.10.          - 102    -    Expires 15    October    1993
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.           Version 5 - Revision 5.2
  6737.  
  6738.  
  6739.     else
  6740.         retrieve service key for
  6741.          packet.ticket.{sname,srealm,enc-part.etype,enc-part.skvno};
  6742.     endif
  6743.     if (no_key_available) then
  6744.         if (cannot_find_specified_skvno) then
  6745.             error_out(KRB_AP_ERR_BADKEYVER);
  6746.         else
  6747.             error_out(KRB_AP_ERR_NOKEY);
  6748.         endif
  6749.     endif
  6750.     decrypt    packet.ticket.enc-part into decr_ticket    using retrieved    key;
  6751.     if (decryption_error())    then
  6752.         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6753.     endif
  6754.     decrypt    packet.authenticator into decr_authenticator
  6755.         using decr_ticket.key;
  6756.     if (decryption_error())    then
  6757.         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6758.     endif
  6759.     if (decr_authenticator.{cname,crealm} !=
  6760.         decr_ticket.{cname,crealm})    then
  6761.         error_out(KRB_AP_ERR_BADMATCH);
  6762.     endif
  6763.     if (decr_ticket.caddr is present) then
  6764.         if (sender_address(packet) is not in decr_ticket.caddr)    then
  6765.             error_out(KRB_AP_ERR_BADADDR);
  6766.         endif
  6767.     elseif (application requires addresses)    then
  6768.         error_out(KRB_AP_ERR_BADADDR);
  6769.     endif
  6770.     if (not    in_clock_skew(decr_authenticator.ctime,
  6771.                   decr_authenticator.cusec)) then
  6772.         error_out(KRB_AP_ERR_SKEW);
  6773.     endif
  6774.     if (repeated(decr_authenticator.{ctime,cusec,cname,crealm})) then
  6775.         error_out(KRB_AP_ERR_REPEAT);
  6776.     endif
  6777.     save_identifier(decr_authenticator.{ctime,cusec,cname,crealm});
  6778.     get system_time;
  6779.     if ((decr_ticket.starttime-system_time > CLOCK_SKEW) or
  6780.         (decr_ticket.flags.INVALID is set))    then
  6781.         /* it hasn't yet become    valid */
  6782.         error_out(KRB_AP_ERR_TKT_NYV);
  6783.     endif
  6784.     if (system_time-decr_ticket.endtime > CLOCK_SKEW) then
  6785.         error_out(KRB_AP_ERR_TKT_EXPIRED);
  6786.     endif
  6787.     /* caller must check decr_ticket.flags for any pertinent details */
  6788.     return(OK, decr_ticket,    packet.ap_options.MUTUAL-REQUIRED);
  6789.  
  6790. A.11.  KRB_AP_REP generation
  6791.     packet.pvno := protocol    version; /* 5 */
  6792.     packet.msg-type    := message type; /* KRB_AP_REP */
  6793.  
  6794.  
  6795. Section    A.11.          - 103    -    Expires 15    October    1993
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.           Version 5 - Revision 5.2
  6803.  
  6804.  
  6805.     body.ctime := packet.ctime;
  6806.     body.cusec := packet.cusec;
  6807.     if (selecting sub-session key) then
  6808.         select sub-session key;
  6809.         body.subkey := sub-session key;
  6810.     endif
  6811.     if (using sequence numbers) then
  6812.         select initial sequence    number;
  6813.         body.seq-number    := initial sequence;
  6814.     endif
  6815.  
  6816.     encode body into OCTET STRING;
  6817.  
  6818.     select encryption type;
  6819.     encrypt    OCTET STRING into packet.enc-part;
  6820.  
  6821. A.12.  KRB_AP_REP verification
  6822.     receive    packet;
  6823.     if (packet.pvno    != 5) then
  6824.         either process using other protocol spec
  6825.         or error_out(KRB_AP_ERR_BADVERSION);
  6826.     endif
  6827.     if (packet.msg-type != KRB_AP_REP) then
  6828.         error_out(KRB_AP_ERR_MSG_TYPE);
  6829.     endif
  6830.     cleartext := decrypt(packet.enc-part) using ticket's session key;
  6831.     if (decryption_error())    then
  6832.         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6833.     endif
  6834.     if (cleartext.ctime != authenticator.ctime) then
  6835.         error_out(KRB_AP_ERR_MUT_FAIL);
  6836.     endif
  6837.     if (cleartext.cusec != authenticator.cusec) then
  6838.         error_out(KRB_AP_ERR_MUT_FAIL);
  6839.     endif
  6840.     if (cleartext.subkey is    present) then
  6841.         save cleartext.subkey for future use;
  6842.     endif
  6843.     if (cleartext.seq-number is present) then
  6844.         save cleartext.seq-number for future verifications;
  6845.     endif
  6846.     return(AUTHENTICATION_SUCCEEDED);
  6847.  
  6848. A.13.  KRB_SAFE    generation
  6849.     collect    user data in buffer;
  6850.  
  6851.     /* assemble packet: */
  6852.     packet.pvno := protocol    version; /* 5 */
  6853.     packet.msg-type    := message type; /* KRB_SAFE */
  6854.  
  6855.     body.user-data := buffer; /* DATA */
  6856.     if (using timestamp) then
  6857.         get system_time;
  6858.         body.timestamp,    body.usec := system_time;
  6859.  
  6860.  
  6861. Section    A.13.          - 104    -    Expires 15    October    1993
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868.           Version 5 - Revision 5.2
  6869.  
  6870.  
  6871.     endif
  6872.     if (using sequence numbers) then
  6873.         body.seq-number    := sequence number;
  6874.     endif
  6875.     body.s-address := sender host addresses;
  6876.     if (only one recipient)    then
  6877.         body.r-address := recipient host address;
  6878.     endif
  6879.     checksum.cksumtype := checksum type;
  6880.     compute    checksum over body;
  6881.     checksum.checksum := checksum value; /*    checksum.checksum */
  6882.     packet.cksum :=    checksum;
  6883.     packet.safe-body := body;
  6884.  
  6885. A.14.  KRB_SAFE    verification
  6886.     receive    packet;
  6887.     if (packet.pvno    != 5) then
  6888.         either process using other protocol spec
  6889.         or error_out(KRB_AP_ERR_BADVERSION);
  6890.     endif
  6891.     if (packet.msg-type != KRB_SAFE) then
  6892.         error_out(KRB_AP_ERR_MSG_TYPE);
  6893.     endif
  6894.     if (packet.checksum.cksumtype is not both collision-proof and keyed) then
  6895.         error_out(KRB_AP_ERR_INAPP_CKSUM);
  6896.     endif
  6897.     if (safe_priv_common_checks_ok(packet))    then
  6898.         set computed_checksum := checksum(packet.body);
  6899.         if (computed_checksum != packet.checksum) then
  6900.             error_out(KRB_AP_ERR_MODIFIED);
  6901.         endif
  6902.         return (packet,    PACKET_IS_GENUINE);
  6903.     else
  6904.         return common_checks_error;
  6905.     endif
  6906.  
  6907. A.15.  KRB_SAFE    and KRB_PRIV common checks
  6908.     if (packet.s-address !=    O/S_sender(packet)) then
  6909.         /* O/S report of sender    not who    claims to have sent it */
  6910.         error_out(KRB_AP_ERR_BADADDR);
  6911.     endif
  6912.     if ((packet.r-address is present) and
  6913.         (packet.r-address != local_host_address)) then
  6914.         /* was not sent    to proper place    */
  6915.         error_out(KRB_AP_ERR_BADADDR);
  6916.     endif
  6917.     if (((packet.timestamp is present) and
  6918.          (not in_clock_skew(packet.timestamp,packet.usec)))    or
  6919.         (packet.timestamp is not present and timestamp expected)) then
  6920.         error_out(KRB_AP_ERR_SKEW);
  6921.     endif
  6922.     if (repeated(packet.timestamp,packet.usec,packet.s-address)) then
  6923.         error_out(KRB_AP_ERR_REPEAT);
  6924.     endif
  6925.  
  6926.  
  6927. Section    A.15.          - 105    -    Expires 15    October    1993
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.           Version 5 - Revision 5.2
  6935.  
  6936.  
  6937.     if (((packet.seq-number    is present) and
  6938.          ((not in_sequence(packet.seq-number)))) or
  6939.         (packet.seq-number is not present and sequence expected)) then
  6940.         error_out(KRB_AP_ERR_BADORDER);
  6941.     endif
  6942.     if (packet.timestamp not present and packet.seq-number not present) then
  6943.         error_out(KRB_AP_ERR_MODIFIED);
  6944.     endif
  6945.  
  6946.     save_identifier(packet.{timestamp,usec,s-address},
  6947.             sender_principal(packet));
  6948.  
  6949.     return PACKET_IS_OK;
  6950.  
  6951. A.16.  KRB_PRIV    generation
  6952.     collect    user data in buffer;
  6953.  
  6954.     /* assemble packet: */
  6955.     packet.pvno := protocol    version; /* 5 */
  6956.     packet.msg-type    := message type; /* KRB_PRIV */
  6957.  
  6958.     packet.enc-part.etype := encryption type;
  6959.  
  6960.     body.user-data := buffer;
  6961.     if (using timestamp) then
  6962.         get system_time;
  6963.         body.timestamp,    body.usec := system_time;
  6964.     endif
  6965.     if (using sequence numbers) then
  6966.         body.seq-number    := sequence number;
  6967.     endif
  6968.     body.s-address := sender host addresses;
  6969.     if (only one recipient)    then
  6970.         body.r-address := recipient host address;
  6971.     endif
  6972.  
  6973.     encode body into OCTET STRING;
  6974.  
  6975.     select encryption type;
  6976.     encrypt    OCTET STRING into packet.enc-part.cipher;
  6977.  
  6978.  
  6979. A.17.  KRB_PRIV    verification
  6980.     receive    packet;
  6981.     if (packet.pvno    != 5) then
  6982.         either process using other protocol spec
  6983.         or error_out(KRB_AP_ERR_BADVERSION);
  6984.     endif
  6985.     if (packet.msg-type != KRB_PRIV) then
  6986.         error_out(KRB_AP_ERR_MSG_TYPE);
  6987.     endif
  6988.  
  6989.     cleartext := decrypt(packet.enc-part) using negotiated key;
  6990.     if (decryption_error())    then
  6991.  
  6992.  
  6993. Section    A.17.          - 106    -    Expires 15    October    1993
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.           Version 5 - Revision 5.2
  7001.  
  7002.  
  7003.         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7004.     endif
  7005.  
  7006.     if (safe_priv_common_checks_ok(cleartext)) then
  7007.         return(cleartext.DATA, PACKET_IS_GENUINE_AND_UNMODIFIED);
  7008.     else
  7009.         return common_checks_error;
  7010.     endif
  7011.  
  7012. A.18.  KRB_CRED    generation
  7013.     invoke KRB_TGS;    /* obtain tickets to be    provided to peer */
  7014.  
  7015.     /* assemble packet: */
  7016.     packet.pvno := protocol    version; /* 5 */
  7017.     packet.msg-type    := message type; /* KRB_CRED */
  7018.  
  7019.     for (tickets[n]    in tickets to be forwarded) do
  7020.         packet.tickets[n] = tickets[n].ticket;
  7021.     done
  7022.  
  7023.     packet.enc-part.etype := encryption type;
  7024.  
  7025.     for (ticket[n] in tickets to be    forwarded) do
  7026.         body.ticket-info[n].key    = tickets[n].session;
  7027.         body.ticket-info[n].prealm = tickets[n].crealm;
  7028.         body.ticket-info[n].pname = tickets[n].cname;
  7029.         body.ticket-info[n].flags = tickets[n].flags;
  7030.         body.ticket-info[n].authtime = tickets[n].authtime;
  7031.         body.ticket-info[n].starttime =    tickets[n].starttime;
  7032.         body.ticket-info[n].endtime = tickets[n].endtime;
  7033.         body.ticket-info[n].renew-till = tickets[n].renew-till;
  7034.         body.ticket-info[n].srealm = tickets[n].srealm;
  7035.         body.ticket-info[n].sname = tickets[n].sname;
  7036.         body.ticket-info[n].caddr = tickets[n].caddr;
  7037.     done
  7038.  
  7039.     get system_time;
  7040.     body.timestamp,    body.usec := system_time;
  7041.  
  7042.     if (using nonce) then
  7043.         body.nonce := nonce;
  7044.     endif
  7045.  
  7046.     if (using s-address) then
  7047.         body.s-address := sender host addresses;
  7048.     endif
  7049.     if (limited recipients)    then
  7050.         body.r-address := recipient host address;
  7051.     endif
  7052.  
  7053.     encode body into OCTET STRING;
  7054.  
  7055.     select encryption type;
  7056.     encrypt    OCTET STRING into packet.enc-part.cipher
  7057.  
  7058.  
  7059. Section    A.18.          - 107    -    Expires 15    October    1993
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.           Version 5 - Revision 5.2
  7067.  
  7068.  
  7069.            using negotiated    encryption key;
  7070.  
  7071.  
  7072. A.19.  KRB_CRED    verification
  7073.     receive    packet;
  7074.     if (packet.pvno    != 5) then
  7075.         either process using other protocol spec
  7076.         or error_out(KRB_AP_ERR_BADVERSION);
  7077.     endif
  7078.     if (packet.msg-type != KRB_CRED) then
  7079.         error_out(KRB_AP_ERR_MSG_TYPE);
  7080.     endif
  7081.  
  7082.     cleartext := decrypt(packet.enc-part) using negotiated key;
  7083.     if (decryption_error())    then
  7084.         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7085.     endif
  7086.     if ((packet.r-address is present or required) and
  7087.        (packet.s-address !=    O/S_sender(packet)) then
  7088.         /* O/S report of sender    not who    claims to have sent it */
  7089.         error_out(KRB_AP_ERR_BADADDR);
  7090.     endif
  7091.     if ((packet.r-address is present) and
  7092.         (packet.r-address != local_host_address)) then
  7093.         /* was not sent    to proper place    */
  7094.         error_out(KRB_AP_ERR_BADADDR);
  7095.     endif
  7096.     if (not    in_clock_skew(packet.timestamp,packet.usec)) then
  7097.         error_out(KRB_AP_ERR_SKEW);
  7098.     endif
  7099.     if (repeated(packet.timestamp,packet.usec,packet.s-address)) then
  7100.         error_out(KRB_AP_ERR_REPEAT);
  7101.     endif
  7102.     if (packet.nonce is required or    present) and
  7103.        (packet.nonce != expected-nonce) then
  7104.         error_out(KRB_AP_ERR_MODIFIED);
  7105.     endif
  7106.  
  7107.     for (ticket[n] in tickets that were forwarded) do
  7108.         save_for_later(ticket[n],key[n],principal[n],
  7109.                    server[n],times[n],flags[n]);
  7110.     return
  7111.  
  7112. A.20.  KRB_ERROR generation
  7113.  
  7114.     /* assemble packet: */
  7115.     packet.pvno := protocol    version; /* 5 */
  7116.     packet.msg-type    := message type; /* KRB_ERROR */
  7117.  
  7118.     get system_time;
  7119.     packet.stime, packet.susec := system_time;
  7120.     packet.realm, packet.sname := server name;
  7121.  
  7122.     if (client time    available) then
  7123.  
  7124.  
  7125. Section    A.20.          - 108    -    Expires 15    October    1993
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.           Version 5 - Revision 5.2
  7133.  
  7134.  
  7135.         packet.ctime, packet.cusec := client_time;
  7136.     endif
  7137.     packet.error-code := error code;
  7138.     if (client name    available) then
  7139.         packet.cname, packet.crealm := client name;
  7140.     endif
  7141.     if (error text available) then
  7142.         packet.e-text := error text;
  7143.     endif
  7144.     if (error data available) then
  7145.         packet.e-data := error data;
  7146.     endif
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.  
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.               - 109    -    Expires 15    October    1993
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.           Version 5 - Revision 5.2
  7199.  
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.                - cx    -    Expires 15    October    1993
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.              Table of Contents
  7268.  
  7269.  
  7270.  
  7271.  
  7272. Overview ..............................................       1
  7273.  
  7274. Background ............................................       2
  7275.  
  7276. 1. Introduction    .......................................       2
  7277.  
  7278. 1.1. Cross-Realm Operation ............................       4
  7279.  
  7280. 1.2. Environmental assumptions ........................       5
  7281.  
  7282. 1.3. Glossary of terms ................................       6
  7283.  
  7284. 2. Ticket flag uses and    requests ......................       9
  7285.  
  7286. 2.1. Initial and pre-authenticated tickets ............       9
  7287.  
  7288. 2.2. Invalid tickets ..................................       9
  7289.  
  7290. 2.3. Renewable tickets ................................      10
  7291.  
  7292. 2.4. Postdated tickets ................................      10
  7293.  
  7294. 2.5. Proxiable and proxy tickets ......................      11
  7295.  
  7296. 2.6. Forwardable tickets ..............................      12
  7297.  
  7298. 2.7. Other KDC options ................................      12
  7299.  
  7300. 3. Message Exchanges ..................................      13
  7301.  
  7302. 3.1. The Authentication    Service    Exchange ..............      13
  7303.  
  7304. 3.1.1. Generation of KRB_AS_REQ    message    ...............      15
  7305.  
  7306. 3.1.2. Receipt of KRB_AS_REQ message ..................      15
  7307.  
  7308. 3.1.3. Generation of KRB_AS_REP    message    ...............      15
  7309.  
  7310. 3.1.4. Generation of KRB_ERROR message ................      17
  7311.  
  7312. 3.1.5. Receipt of KRB_AS_REP message ..................      17
  7313.  
  7314. 3.1.6. Receipt of KRB_ERROR message ...................      18
  7315.  
  7316. 3.2. The Client/Server Authentication Exchange ........      18
  7317.  
  7318. 3.2.1. The KRB_AP_REQ message .........................      18
  7319.  
  7320. 3.2.2. Generation of a KRB_AP_REQ message .............      19
  7321.  
  7322.  
  7323.                - i -     Expires 15    October    1993
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.           Version 5 - Revision 5.2
  7331.  
  7332.  
  7333. 3.2.3. Receipt of KRB_AP_REQ message ..................      19
  7334.  
  7335. 3.2.4. Generation of a KRB_AP_REP message .............      21
  7336.  
  7337. 3.2.5. Receipt of KRB_AP_REP message ..................      22
  7338.  
  7339. 3.2.6. Using the encryption key    .......................      22
  7340.  
  7341. 3.3. The Ticket-Granting Service (TGS) Exchange    .......      23
  7342.  
  7343. 3.3.1. Generation of KRB_TGS_REQ message ..............      24
  7344.  
  7345. 3.3.2. Receipt of KRB_TGS_REQ message .................      25
  7346.  
  7347. 3.3.3. Generation of KRB_TGS_REP message ..............      26
  7348.  
  7349. 3.3.3.1. Encoding the transited    field .................      28
  7350.  
  7351. 3.3.4. Receipt of KRB_TGS_REP message .................      30
  7352.  
  7353. 3.4. The KRB_SAFE Exchange ............................      30
  7354.  
  7355. 3.4.1. Generation of a KRB_SAFE    message    ...............      30
  7356.  
  7357. 3.4.2. Receipt of KRB_SAFE message ....................      31
  7358.  
  7359. 3.5. The KRB_PRIV Exchange ............................      31
  7360.  
  7361. 3.5.1. Generation of a KRB_PRIV    message    ...............      32
  7362.  
  7363. 3.5.2. Receipt of KRB_PRIV message ....................      32
  7364.  
  7365. 3.6. The KRB_CRED Exchange ............................      33
  7366.  
  7367. 3.6.1. Generation of a KRB_CRED    message    ...............      33
  7368.  
  7369. 3.6.2. Receipt of KRB_CRED message ....................      33
  7370.  
  7371. 4. The Kerberos    Database ..............................      34
  7372.  
  7373. 4.1. Database contents ................................      34
  7374.  
  7375. 4.2. Additional    fields ................................      35
  7376.  
  7377. 4.3. Frequently    Changing Fields    .......................      36
  7378.  
  7379. 4.4. Site Constants ...................................      36
  7380.  
  7381. 5. Message Specifications .............................      37
  7382.  
  7383. 5.1. ASN.1 Distinguished Encoding Representation ......      37
  7384.  
  7385. 5.2. ASN.1 Base    Definitions ...........................      37
  7386.  
  7387.  
  7388.  
  7389.                - ii    -    Expires 15    October    1993
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.           Version 5 - Revision 5.2
  7397.  
  7398.  
  7399. 5.3. Tickets and Authenticators    .......................      40
  7400.  
  7401. 5.3.1. Tickets ........................................      40
  7402.  
  7403. 5.3.2. Authenticators .................................      46
  7404.  
  7405. 5.4. Specifications for    the AS and TGS exchanges ......      47
  7406.  
  7407. 5.4.1. KRB_KDC_REQ definition .........................      47
  7408.  
  7409. 5.4.2. KRB_KDC_REP definition .........................      54
  7410.  
  7411. 5.5. Client/Server (CS)    message    specifications ........      57
  7412.  
  7413. 5.5.1. KRB_AP_REQ definition ..........................      57
  7414.  
  7415. 5.5.2. KRB_AP_REP definition ..........................      58
  7416.  
  7417. 5.5.3. Error message reply ............................      59
  7418.  
  7419. 5.6. KRB_SAFE message specification ...................      60
  7420.  
  7421. 5.6.1. KRB_SAFE    definition ............................      60
  7422.  
  7423. 5.7. KRB_PRIV message specification ...................      61
  7424.  
  7425. 5.7.1. KRB_PRIV    definition ............................      61
  7426.  
  7427. 5.8. KRB_CRED message specification ...................      62
  7428.  
  7429. 5.8.1. KRB_CRED    definition ............................      63
  7430.  
  7431. 5.9. Error message specification ......................      65
  7432.  
  7433. 5.9.1. KRB_ERROR definition ...........................      65
  7434.  
  7435. 6. Encryption and Checksum Specifications .............      67
  7436.  
  7437. 6.1. Encryption    Specifications ........................      68
  7438.  
  7439. 6.2. Encryption    Keys ..................................      70
  7440.  
  7441. 6.3. Encryption    Systems    ...............................      71
  7442.  
  7443. 6.3.1. The NULL    Encryption System (null) ..............      71
  7444.  
  7445. 6.3.2. DES in CBC mode with a CRC-32 checksum (des-
  7446. cbc-crc) ..............................................      71
  7447.  
  7448. 6.3.3. DES in CBC mode with an MD4 checksum (des-
  7449. cbc-md4) ..............................................      71
  7450.  
  7451. 6.3.4. DES in CBC mode with an MD5 checksum (des-
  7452. cbc-md5) ..............................................      72
  7453.  
  7454.  
  7455.               - iii    -    Expires 15    October    1993
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.           Version 5 - Revision 5.2
  7463.  
  7464.  
  7465. 6.4. Checksums ........................................      73
  7466.  
  7467. 6.4.1. The CRC-32 Checksum (crc32) ....................      74
  7468.  
  7469. 6.4.2. The RSA MD4 Checksum (rsa-md4) .................      74
  7470.  
  7471. 6.4.3. RSA MD4 Cryptographic Checksum Using DES
  7472. (rsa-md4-des) .........................................      74
  7473.  
  7474. 6.4.4. The RSA MD5 Checksum (rsa-md5) .................      75
  7475.  
  7476. 6.4.5. RSA MD5 Cryptographic Checksum Using DES
  7477. (rsa-md5-des) .........................................      75
  7478.  
  7479. 6.4.6. DES cipher-block    chained    checksum (des-mac)
  7480.  
  7481. 6.4.7. RSA MD4 Cryptographic Checksum Using DES
  7482. alternative (rsa-md4-des-k) ...........................      77
  7483.  
  7484. 6.4.8. DES cipher-block    chained    checksum alternative
  7485. (des-mac-k) ...........................................      77
  7486.  
  7487. 7. Naming Constraints .................................      77
  7488.  
  7489. 7.1. Realm Names ......................................      77
  7490.  
  7491. 7.2. Principal Names ..................................      79
  7492.  
  7493. 7.2.1. Name of server principals ......................      80
  7494.  
  7495. 8. Constants and other defined values .................      80
  7496.  
  7497. 8.1. Host address types    ...............................      80
  7498.  
  7499. 8.2. KDC messages .....................................      81
  7500.  
  7501. 8.2.1. IP transport ...................................      81
  7502.  
  7503. 8.2.2. OSI transport ..................................      81
  7504.  
  7505. 8.2.3. Name of the TGS ................................      82
  7506.  
  7507. 8.3. Protocol constants    and associated values .........      82
  7508.  
  7509. 9. Interoperability requirements ......................      84
  7510.  
  7511. 9.1. Specification 1 ..................................      85
  7512.  
  7513. 9.2. Recommended KDC values ...........................      86
  7514.  
  7515. 10. Acknowledgments ...................................      87
  7516.  
  7517. 11. REFERENCES ........................................      88
  7518.  
  7519.  
  7520.  
  7521.                - iv    -    Expires 15    October    1993
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.           Version 5 - Revision 5.2
  7529.  
  7530.  
  7531. A. Pseudo-code for protocol processing ................      90
  7532.  
  7533. A.1. KRB_AS_REQ    generation ............................      90
  7534.  
  7535. A.2. KRB_AS_REQ    verification and KRB_AS_REP genera-
  7536. tion ..................................................      90
  7537.  
  7538. A.3. KRB_AS_REP    verification ..........................      94
  7539.  
  7540. A.4. KRB_AS_REP    and KRB_TGS_REP    common checks .........      94
  7541.  
  7542. A.5. KRB_TGS_REQ generation ...........................      95
  7543.  
  7544. A.6. KRB_TGS_REQ verification and KRB_TGS_REP gen-
  7545. eration    ...............................................      96
  7546.  
  7547. A.7. KRB_TGS_REP verification .........................     101
  7548.  
  7549. A.8. Authenticator generation .........................     102
  7550.  
  7551. A.9. KRB_AP_REQ    generation ............................     102
  7552.  
  7553. A.10. KRB_AP_REQ verification .........................     102
  7554.  
  7555. A.11. KRB_AP_REP generation ...........................     103
  7556.  
  7557. A.12. KRB_AP_REP verification .........................     104
  7558.  
  7559. A.13. KRB_SAFE generation .............................     104
  7560.  
  7561. A.14. KRB_SAFE verification ...........................     105
  7562.  
  7563. A.15. KRB_SAFE and KRB_PRIV common checks .............     105
  7564.  
  7565. A.16. KRB_PRIV generation .............................     106
  7566.  
  7567. A.17. KRB_PRIV verification ...........................     106
  7568.  
  7569. A.18. KRB_CRED generation .............................     107
  7570.  
  7571. A.19. KRB_CRED verification ...........................     108
  7572.  
  7573. A.20. KRB_ERROR    generation ............................     108
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.                - v -     Expires 15    October    1993
  7588.  
  7589.  
  7590.  
  7591.